0% found this document useful (0 votes)
15 views415 pages

KR CS Box 2.7 MC-Basic Commands en

Uploaded by

bje23750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views415 pages

KR CS Box 2.7 MC-Basic Commands en

Uploaded by

bje23750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 415

MC-Basic Commands 2.

7
For KUKA.ControlStudio 2.7

Issued: 18.04.2024
MC-Basic Commands 2.7 V1

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 1 / 415


MC-Basic Commands 2.7

© 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.

Translation of the original documentation

2 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 3 / 415


MC-Basic Commands 2.7

Summary of Common Commands

System Commands
CLOCK Return the number of system clock ticks

ERROR Query the last system error message

ERRORNUMBER Query the number of the last system error

IPADDRESSMASK Set or query the IP address and subnet mask for the
Ethernet interface

NAME Set the name of the controller

PING Test whether a remote host is reachable. A run-time


error is returned if the host is not reachable or does
not answer.
RECORD Record arm (not trigger) data. Data are recorded into
the specified file, which is then retrieved for viewing.

RECORDOFF The recording action is stopped if the specified


number of points have been recorded.

RECORDON Starts the recording process.

TIME Query or set the current time of day

Robot Control Commands


ATTACH Attach a task to a motion element

CIRCLE Issue a circular(arc) path trajectory for the specified


group/robot

DETACH Detach a task from a motion element

GOHOME Move group to the HOME position

HERE Return the actual robot Cartesian coordinates

ISMOVING Indicate whether the motion profiler is active

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

MOVE Execute point-to-point move from current position to


target position of a single axis or a group of axes

4 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

MOVES Move the robot along a straight line in world-space

OPMODE Axis property. Assigning this property allows you to


change the drive operation mode.

POWER_OFF Set the robot disable

POWER_ON Set the robot enable

PROCEED Continue executing motion after that motion had been


stopped by a STOP command from a different context

SMOVE Issue a spline path motion to move the robot through


given points to target in world-space

STOP Stop the group or axis motion

STOPPATH Stop the current motion of the attached robot or axis.


Current motion command and Pending motion
command will be stored.

SETWORKSPACE Set the specify workspace enable or disable

WAITFORMOTION Cause the program to wait until the currently


executing motion is completed

Torque Commands
TORQUEADDCOMMAND Returns the axis additive torque command value

TORQUECOMMAND Return an element torque command value

TORQUEERROR Returns the axis torque error value

TORQUEFEEDBACK Return an element torque feedback value

TORQUEGEARCOMMAND Returns the calculated torque acting on the gearbox


output shaft

TORQUEGEARFEEDBACK Returns the calculated torque acting on the gearbox


output shaft

I/O Commands

SETIO Set value for io signal

GETIO Get current value of io signal

PULSE Generate a pulse wave on a digital IO signal

WAIT Stops the program until io conditions are fulfilled

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 5 / 415


MC-Basic Commands 2.7

Coordinate Commands
BASE Informs the used base in system

TOOL Informs the used tool in system

WORKPIECE Informs the used workpiece in system

USERFRAME Informs the used user frame in system

SELECTBASE Switch base frame in program

SELECTTOOL Switch tool frame in program

SELECTUSERFRAME Switch user frame in program

SETTOOL Set tool frame value

SETUSERFRAME Set user frame value

Program Control Commands


PROGRAM_..._END_PROGRAM Delimit the main section of code in a task

FUNCTION_..._END_FUNCTION Delimit a function within a task

SUB_..._END_SUB Delimit a subroutine within a task

CALL Transfer execution of the task to the subprogram


being referenced

IF_..._THEN_..._ELSE Enable one section of code or another to be executed,


depending on the state of a specified condition

DO_..._LOOP Execute a section of code an indefinite number of


times

FOR_..._NEXT Repeats the statements enclosed in the loop a


number of times

WHILE_..._END_WHILE Delimit a WHILE loop, depending on the loop


condition

GOTO Perform an unconditional branch to another section of


code

IMPORT Import a library file into a task

SELECT_..._CASE Enables one of a number of code sections to be


executed, depending on the value of a
<SelectExpression>

REM Insert comments into code

SLEEP Delay the task for a specified period of time in


milliseconds

TRY_..._END_TRY Trap synchronous errors in one section of code

6 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

File Operation Commands


CLOSE Release a file handle and close the file

DELETE Delete a file from the Flash Disk

DELETE$ Delete a file from the Flash Disk

FILESIZE$ Return the size of a file in bytes

INPUT$ Return a string of characters from the specified port or


file

LOC Return the number of characters waiting in the input


buffer

OPEN_FILE Open an existing file or creates new one (in “write”


mode)

SAVE Create a file with name defined by string expression

Socket Communication Commands


ACCEPT Binds a TCP socket to specific port and accepts a
connection

CONNECT Requests a TCP connection from the remote host

OPENSOCKET Creates a TCP socket and put socked descriptor to


the specified device handle

Variable Commands
COMMON_OR_DIM_SHARED_..._A Create a user exception and define a corresponding
S_NOTE_OR_ERROR_ASCII_NUM error message
BER

COMMON_OR_DIM_SHARED_OR_ Define user variables as DOUBLE type


DIM_..._AS_DOUBLE

COMMON_OR_DIM_SHARED_OR_ Define user variables as JOINT type


DIM_..._AS_JOINT_OF

COMMON_OR_DIM_SHARED_OR_ Define user variables as LOCATION type


DIM_..._AS_LOCATION_OF

COMMON_OR_DIM_SHARED_OR_ Define user variables as LONG type


DIM_..._AS_LONG

COMMON_OR_DIM_SHARED_OR_ Define user variables as STRING type


DIM_..._AS_STRING

COMMON_SHARED_..._AS_SEMA Define new semaphore variables in the system


PHORE

COMMON_SHARED_OR_DIM_SHA Define new user data type, must first be defined in


RED_OR_DIM_..._AS_TYPE configuration file

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 7 / 415


MC-Basic Commands 2.7

VARLIST Return a list of the variable and constant names


defined in the system

VARLIST$ Return a list of the variable and constant names


defined in the system

Point Operation Commands


CASTJOINT Creates and returns a generic joint type of point

CASTLOCATION Creates and returns a generic location type of point

CASTPOINT Creates and returns a generic point

DISTL Calculates the distance (in length units) between two


points

GETARM Get arm configuration of target point position(0/1/2)

DISTR Calculates the distance (in angle units) between two


points

PRINTPOINT Prints only variables that were declared as a location

TOCART Converts a joint point to a location point

TOJOINT Converts a location point to a joint point

SETARM Set arm of a location point

Numeric Value Commands


ABS Return the absolute value of the argument

ACOS Return the inverse cosine of the expression in radians

ARRAYSIZE Return the size of an array’s dimension according to


the dimension number (1 for the first dimension, 2 for
the second dimension, etc)

ASIN Return the inverse sine of the expression in radians

ATAN2 ATAN2 is used when it is necessary to know both the


absolute value of the angle and the quadrant

ATN Return the inverse tangent of the expression in


radians

BIN$ Return the string representation of a number in a


binary format

COS Return the cosine of the expression in radians

EXP Calculate the exponential function

HEX$ Return the string representation of a number in


hexadecimal format

8 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

INT Return the largest long value less than or equal to a


numeric expression

LOG Return the natural logarithm of the expression

ROUND Rounds the argument to the nearest whole number

SGN Return the sign of the expression

SIN Return the sine of an angle in radians

SQRT Return the square root of the numeric expression

TAN Return the tangent of an angle given in radians

LONGTOFLOAT Data convert from long to float

FLOATTOLONG Data convert from float to long

LONGTODOUBLE Data convert from long to double

DOUBLETOLONG Data convert from double to long

String Commands
ASC Return an ASCII character value from within an ASCII-
8 string, and the Unicode value from within a UTF-8
string

CHR$ Return a one-character string corresponding to a


given ASCII value

CLEARMSG Clear all message logs

INSTR Return the position of the starting character of a


substring in a string

LCASE$ Return a copy of the string passed to it with all the


uppercase letters converted to lowercase

LEFT$ Return the specified number of characters from the


left-hand side of the string

LEN Return the length of the input string as the number of


characters in an ASCII-8 string, or the number of
symbols in a UTF-8 string

LTRIM$ Return the right-hand part of a string after removing


any blank spaces at the beginning

MID$ Returns the specified number of characters from the


string, starting at the character at position <start>

PRINT Multiple strings and expressions are printed,


separated by either a comma or a semicolon

RIGHT$ Return the specified number of characters from the


right-hand side of the string

RTRIM$ Return the left-hand part of a string after removing any


blank spaces at the end

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 9 / 415


MC-Basic Commands 2.7

SIZE Return the number of bytes taken up by the input


string

SPACE$ Generates a string consisting of the specified number


of blank spaces

STR$ Return the string representation of a number

STRD$ Return the string representation of a double-type


number

STRING$ Produce a new string with the specified number of


characters

STRL$ Return the string representation of long-type number

TOASCII8$ Convert the UTF-8 coding format of the input string


into the ASCII-8 coding format

TOUTF8$ Convert the ASCII-8 coding format of the input string


into the UTF-8 coding format

TYPEOF Return a number representing the type of the string (0


for no-type, 1 for ASCII-8, or 2 for UTF-8)

UCASE$ Return a copy of the string passed to it with all the


lowercase letters converted to uppercase

UTF$ Return a UTF-8 string corresponding to a given


Unicode value

UTFSTRING$ Produce a new UTF-8 string with the specified number


of symbols

VAL Return the real value represented by the characters in


the input string

SPLITSTR Split string by the specified split.

Motion Parameters Commands


ACCELCMDCART Returns the commanded robot acceleration in
Cartesian coordinates

ACCELERATION Acceleration rate of the motion profile

ACCELERATIONROT Rotation acceleration of the robot

ACCELERATIONSCALE Percentage of desired acceleration and deceleration


compared to maximal possible velocity for this type
of movement

ACCELERATIONTRANS Translation acceleration of the robot

ARMCMD Working (command) robot configuration

ARMFBK Actual (current) robot configuration

BLENDMETHOD Blending method (algorithm) which is to be used

10 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

BLENDPERCENTAGE Percentage value of blending for the specified


blending pair and specified blending method

BLENDENDPROTECTED Protected part of the move that is guaranteed not


going to be blended(from end point)

BLENDSTARTPROTECTED Protected part of the move that is guaranteed not


going to be blended(from start point)

BLENDDISTANCE Set the path length condition of starting blend motion

BLENDORIENTATION Set the orientation condition of starting blend motion

DECELERATION Deceleration rate of the motion profile

DECELERATIONROT Rotation deceleration of the robot

DECELERATIONTRANS Translation deceleration of the robot

JERK Jerk (rate of change of acceleration) on the element

JERKROT Rotation jerk of the robot

JERKTRANS Translation jerk of the robot

JOFOLLOW Joint target control for MOVE cartesian target

POSITIONCOMMAND Position command generated by the motion profiler

POSITIONERROR Position following error, which is the difference


between position command and the position
feedback

POSITIONFEEDBACK Actual position of the element

VELOCITYCOMMAND Velocity command

VELOCITYCOMMANDCARTESIAN Current Cartesian command velocity of the robot's


TCP

VELOCITYERROR Velocity following error, which is the difference


between velocity command and the velocity
feedback

VELOCITYFEEDBACK Actual spatial velocity of the element

VELOCITYFEEDBACKCARTESIAN Current feedback velocity of the robot's TCP

VELOCITYFINALROT Rotation velocity of the robot

VELOCITYFINALTRANS Translation velocity of the robot

VELOCITYMAX Maximum allowed velocity of the element

VELOCITYMAXROT Maximum allowed rotation velocity of the robot

VELOCITYMAXTRANS Maximum allowed translation velocity of the robot

VELOCITYOVERRIDE Actual element velocity by multiplying the velocity by


the specified override value

VELOCITYOVERSPEED Axis overspeed value of velocity

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 11 / 415


MC-Basic Commands 2.7

VELOCITYRATE Maximum velocity rate of motion element

VELOCITYROT Defines the rotation (orientation) velocity of the robot

VELOCITYROTVALUE Rotational velocity value of the robot's tool tip, in


degrees per second

VELOCITYSCALE Specifies percentage of desired cruise velocity


compared to maximal possible velocity for this type
of movement

VELOCITYTRANS Translation velocity of the robot

VELOCITYTRANSFEEDBACKVALUE Magnitude of the feedback linear velocity of the


robot's TCP

VELOCITYTRANSVALUE Translation velocity value of the robot's tool tip, in


millimeters per second

ORITYPE SMOVE motion command orientation control

PASSINDEX Control point passed for SMOVE command

XMAX Pre-computation maximum limitation of the robot


Cartesian movements in X direction

XMIN Pre-computation minimum limitation of the robot


Cartesian movements in X direction

YMAX Pre-computation maximum limitation of the robot


Cartesian movements in Y direction

YMIN Pre-computation minimum limitation of the robot


Cartesian movements in Y direction

ZMAX Pre-computation maximum limitation of the robot


Cartesian movements in Z direction

ZMIN Pre-computation minimum limitation of the robot


Cartesian movements in Z direction

System Built-in Application Commands


GRP_CLOSE_GRIPPER Close the specify gripper

GRP_OPEN_GRIPPER Opens the specify gripper

PAYLOADINERTIA Payload inertia around the axis of the last joint

PAYLOADLX Payload mass center distance in x direction

PAYLOADLY Payload mass center distance in y direction

PAYLOADMASS Payload mass of an element

PAYLOADMAX Maximum allowed payload mass of an element

PLT_GET_INDEX_STATUS Get the quantity of items on a pallet

PLT_MOVE_TO_ENTRY_POSITION Robot move to the entry position of one pallet

12 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PLT_PICK_FROM_PALLET Robot move to the next item on the pallet

PLT_PLACE_ON_PALLET Robot (which is holding an item) move to the next


available position on the pallet

PLT_RETRACT_FROM_ITEM Robot move to the Retract position of current item in


one pallet

PLT_SET_INDEX_STATUS Set the quantity of items on a pallet

PLT_SET_INDEX_STATUS_EMPTY Set the quantity of items to be 0 on a pallet

PLT_SET_INDEX_STATUS_FULL Set the quantity of items to be full on a pallet

VCLOSETCP Manually close an opened socket

VGETJOBDATA Get the Respond Data from the vision station

VGETJOBERROR Get the Respond error from the vision station

VGETJOBSTATUS Get the Respond Status from the vision station

VOPENTCP Open a vision socket

VPIXELTOPOS Convert pixel coordinates to robot coordinates

VRECEIVEDATA Receive a user-defined string via TCP IP protocol

VRUNJOB Connect to vision station and run the Vision Task

VRUNJOBFULL Get the respond data or respond error without dealing


with the respond status

VSENDCMD Send a user-defined string via TCP IP protocol

VSTOPJOB Stop one running vision station job

DRIVE_ENABLE_I2T_PROTECTION Open I2T protection

DRIVE_DISABLE_I2T_PROTECTION Close I2Tprotection

Collision Detect Command

PEAKVELERR Return peak velocity error of the specified axis

RESETPEAKVALUE Clear peak torque value and peak velocity error of


all axes

SETVELERRTHRESHOLD Set velocity error threshold of collision detect

COLLISIONDETECT Set collision detect switches

SETDRIVETORQUELIMIT Set maximum torque limit of all drive

DRIVETORQUELIMIT Set maximum torque limit of single drive

PEAKTORQUE Returns peak torque value

VELERRTHRESHOLD Set velocity error threshold of collision detect

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 13 / 415


MC-Basic Commands 2.7

SETDEFVELERRTHRESHOLD Set default velocity error threshold to evaluate


collision detect condition

14 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

MC-Basic Commands Reference


Command will be explained as following example format in this section.

Command (example)
Description
The description of this Command.
NOTE
The notices of this Command

(Perhaps not exist)


Short form
The short from of the Command Syntax.

(Perhaps not exist)


Syntax
Syntax is the format when the command is explicit used. Syntax contains
several Keywords and Parameters of the Command. Use ‘<>’ to indicate the
Parameters, use ‘{ }’ to indicate the Optional Keywords or Parameters.
Domain
Domain is the element that this command belongs to. Element may be
System/Axis/Element/Robot/Task and so on. Commands with domain need to
be used as “<Domain Name>.Command ”

(Perhaps not exist)


Parameters
< Parameters >: the description of the parameters , Parameter data type ,
Parameter data limitation

{< Parameters > }:Optional Parameter

(Perhaps not exist)


Return Value
The description of the return value

<return value>: return value date type

(Perhaps not exist)


Limitations
Limitation of the Command use

(Perhaps not exist)


Examples
Examples and descriptions about how to use the Command
See Also
Other relevant Command with hyperlink. You could click the link automatically
jump to target Command.

(Perhaps not exist)

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 15 / 415


MC-Basic Commands 2.7
A

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)

16 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<value>: Long, absolute value


Limitations
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis

A1.Absolute = False

?A1.Absolute

Move A1 100 absolute = True


Robot

SCARA.Absolute = False

Move SCARA {100, 50, 0, 0} absolute = True


See Also
MOVE, MOVES, CURRENTABSOLUTE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 17 / 415


MC-Basic Commands 2.7

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

18 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

ACCELERATION
Description
This property sets the acceleration rate of the motion profile.

When executing a motion command, ACCELERATION should be less than or


equal to ACCELERATIONMAX. If it is greater, the motion is executed using
the ACCELERATIONMAX value.

This property can be used inside a motion command to override the


permanent value.
Short form
<element>.Acc
Syntax
<element>.Acceleration = <expression >

?<element>.Acceleration
Domain
ELEMENT
Parameters
<element>: valid motion element

< expression >: Double, acceleration rate value, Greater than 0


Limitations
The ratio between jerk and acceleration is limited by the following relation:

Jerk/Acc < 0.9 * pi/5T

where T is the sample time in seconds. For a cycle time of 2 msec, this value
is 282.74.

Use SMOOTHFACTOR to have jerk calculated automatically.

To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis

A1.acceleration = 1e10

Move A1 100 acc = 2e10


Robot

SCARA.acceleration = 1e10

Move SCARA {100, 50, 0, 0} acc = 2e10


See Also
ACCELERATIONMAX, ACCELERATIONCOMMAND,
ACCELERATIONERROR, DECELERATION, JERK, JUMP, MOVE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 19 / 415


MC-Basic Commands 2.7

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

20 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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 an axis, the acceleration error is the difference between the acceleration


command and acceleration feedback.

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 21 / 415


MC-Basic Commands 2.7

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

22 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

ACCELERATIONMAX
Description
Defines the maximum allowed element acceleration.

If you specify an acceleration higher than ACCELERATIONMAX, the system


sets the value to ACCELERATIONMAX and notifies you.
Short form
<element>.AMax
Syntax
<element>.AccelerationMax = <expression>

?<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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 23 / 415


MC-Basic Commands 2.7

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

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal Only
Examples
amrot = 6000 ‘set for default robot ---- SCARA
See Also
ACCELERATIONROT, CIRCLE, MOVES

24 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal Only
Examples
amtran = 6000 ‘set for default robot ---- SCARA
See Also
CIRCLE, MOVES, ACCELERATIONTRANS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 25 / 415


MC-Basic Commands 2.7

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.

The value cannot be greater than ACCLERATIONMAXROT. The system


always takes the smaller of the two with a notification message sent to the
user.
Short form
<ROBOT>.arot
Syntax
<ROBOT>.arot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Read/Write, Modal/Nodal
Examples
arot = 6000 ‘set for default robot ---- SCARA
See Also
ACCELERATIONMAXROT, CIRCLE, MOVES, ACCELERATIONTRANS

26 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

ACCELERATIONSCALE
Description
This property specifies percentage of desired acceleration and deceleration
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.

This properties used inside a motion command to override the permanent


value.
Short form
<element>.Ascale
Syntax
<element>. ACCELERATIONSCALE = <expression>

?<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

Move A1 TargetPos Ascale = 20


Robot

SCARA.AScale =40

Move SCARA {100, 20, 0, 0} Ascale = 22


See Also
ACCELERATIONMAX, ACCELERATION, VELOCITYSCALE,
DECELERATION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 27 / 415


MC-Basic Commands 2.7

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.

The value cannot be greater than robot.ACCELERATIONMAXTRANS. The


system always takes the smaller of the two with a notification message sent to
the user.
Short form
<ROBOT>.atran
Syntax
<ROBOT>.atran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1to Maxdouble


Examples
atran = 6000 ‘set for default robot ---- SCARA
See Also
ACCELERATIONMAXTRANS, ACCELERATIONROT, CIRCLE, MOVES

28 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<accepting device number>: Long , 1 to 255

<port number>: Long


Limitations
Task only
Examples
Accept(#1,65456)

OpenSocket Options=1 as #1 'explicit socket open for listening for port

OpenSocket Options=1 as #2 'explicit socket open for listening accepting a


new connection

Accept(#1, #2, 6002)


See Also
CLOSE, CONNECT, OPENSOCKET, PING, IPADDRESSMASK

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 29 / 415


MC-Basic Commands 2.7

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

30 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

The arm flag defines LEFTY or RIGHTY configurations according:

For SCARA robots:

j2.pcmd > 0 -> Lefty

j2.pcmd = 0 -> Auto

j2.pcmd < 0 -> Righty

How this flag is computed differs in different kinematic models.


NOTE
A Cartesian motion (MOVES or CIRCLE) is not allowed when this flag differs
from ARMFBK.
Short form
<ROBOT>.acmd
Syntax
?<ROBOT>.armcmd

<ROBOT>.armcmd = <numeric expression>


Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Long


Limitations
Read/Write, Modal/Nodal
Examples
scara.armcmd=1

MOVES SCARA {1,2,3,4} armcmd=0

CIRCLE SCARA angle = … circlecenter = … armcmd=1


See Also
ARMFBK

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 31 / 415


MC-Basic Commands 2.7

ARMFBK
Description
Returns the actual (current) robot configuration.

In SCARA robots each Cartesian position can be obtained by two different


angles of the second joint.

These two solutions represent two solutions of the robots inverse kinematics
equations, or in other words the robot configurations.

Usually they are called “lefty” and “righty” 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.

j2.pfb > 0 -> Lefty

j2.pfb = 0 -> Undefined(Auto)

j2.pfb < 0 -> Righty


Short form
<ROBOT>.afbk
Syntax
?<ROBOT>.armfbk
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
Return Value
Returns the actual (current) robot configuration

<return value>: Long

0 - Undefined

1 - Lefty

2 - Righty
Limitations
Read Only, Modal Only
Examples
?scara.armfbk
See Also
ARMCMD

32 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<long_expression>: given dimension index, Long


Return Value
Returns the size of an array’s dimension according to the dimension number
(1 for the first dimension, 2 for the second dimension, etc)

<variable>: size of array, Long


Examples
?ArraySize (Arr, 2)

Size = ArraySize (Arr, X)

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 33 / 415


MC-Basic Commands 2.7

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)

97‘returns the ASCII code for the letter "a"

?ASC("example")

101‘returns the ASCII code for the letter "e"

Common Shared UTF8Str as String of UTF8

UTF8Str = UTF$(196) + UTF$(197) + UTF$(198)

?ASC(UTF8str,2)

197
See Also
INSTR, SPACE$, STRING$, UTF$, CHR$

34 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 35 / 415


MC-Basic Commands 2.7

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

< x_expression >: value in x axis, any valid expression , Double , ±


MaxDouble
Return Value
returns the inverse tangent of the expression in radians. The result gives the
real angle in the range ±π radians.
Limitations
Read only
Examples
?Atan2(1, -1)

returns 0.75×π

?Atan2(-1, 1)

returns -0.25×π
See Also
ACOS, ASIN, ATN, TAN

36 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Dim Theta as double

x=1

y=2

Theta=ATN(y/x)

End Program
See Also
ACOS, ASIN, ATAN2, TAN

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 37 / 415


MC-Basic Commands 2.7

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$

38 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read Only
Examples
Axis

?A1.AttachedTo
Robot

?SCARA.AttachedTo
See Also
ATTACH, DETACH, ATTACHTO$, DETACHFROM, DETACHFROM$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 39 / 415


MC-Basic Commands 2.7

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.

<element>: Element specification can be axis, group or robot.


Examples
attachto a16 File = ttt.prg

detachfrom a16 File = ttt.prg


See Also
ATTACH, DETACH, ATTACHTO$, DETACHFROM, DETACHFROM$

40 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<element name>: Element specification can be axis, group or robot.


Examples
attachto$ a16 File = "ttt.prg"

detachfrom$ a16 File = "ttt.prg"


See Also
ATTACH, DETACH, ATTACHTO, DETACHFROM, DETACHFROM$,
ATTACHEDTO

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 41 / 415


MC-Basic Commands 2.7

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

<return value>: Long, 0 to 100


Limitations
Read only. Cannot appear in an event condition.
Examples
?System.ALoad ‘returns 45

42 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

returns a1, a2, a3, a4 in a four-axis system

?axislist a*
See Also
PLSLIST, GROUPLIST, TASKLIST, VARLIST, VARLIST$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 43 / 415


MC-Basic Commands 2.7
B

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.

The default base transformation is the NULL transformation, which can be


expressed as SCARA.base = #{0,0,0,0}
Syntax
Base = <robot location point>

?Base
Domain
ROBOT
Parameters
<robot location point> : Location
Return Value
returns the base location in world coordinate

<return value>: Location


Examples
Scara.Base = #{90, 180, 0, 0}

?Scara.UserFrame:WorkPiece:Base:Tool

Prints the following: {90 , 90 , 90 , 180}


See Also
TOOL, WORKPIECE, USERFRAME, SELECTBASE

44 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Examples
myStr = Bin$(58699)

?myStr

Prints the following: 1110010101001011


See Also
HEX$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 45 / 415


MC-Basic Commands 2.7

BLENDDISTANCE
Description
Defines the distance of the movement’s length that will be blended with the
next movement.

This parameter is only applicable to cartesian motion, not to a joint motion. It


specifies a desired value by the user, however it cannot be always guranteed,
because the actual blending distance depends on the second motion length
as well. In addition, the user is allowed to give any value no less than zero, but
internally it will be limited to the half length (both translation and orientation) of
the movement in the blending calculation.
NOTE
If value is bigger than maximum variation of orientation, use maximum allowed
value.

BlendDistance has a higher priority than BlendPercentage, if BlendDistance is


set, BlendPercentage will be covered. If set BlendDistance and BlendOrienta-
tion at the same time, robot will start blend motion depending on the condition
which is triggered first.

Applicable only with BlendMethod = 1 (SP blending). In cases of non-SP


blending or PTP motion, its value will be silently ignored (no error reported).
Short form
BlendDis
Syntax
<motion> <element> <position> BlendDistance = <value>
Parameters
<element>: valid motion element

< value >: Double, the path length of motion to blend with next motion, 0 to
Maxdouble, unit is millimeter
Limitations
Nodal-only
Examples
Axis

Move A1 10 BlendDistance =50


Robot

Move SCARA {10,10,0,0} BlendDis =50


See Also
BLENDMETHOD, BLENDORIENTATION, BLENDPERCENTAGE

46 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

BlendEndProtected has a higher priority than BlendDistance and BlendOrien-


tation, if BlendEndProtected is set (not 0), the end part of current motion will
not blend with next motion and the start part of current motion will be blended
with previous motion partly.
NOTE
If the value is bigger than path length, use path length instead, 0 means
nothing is protected.

Applicable only with BlendMethod = 1 (SP blending). In cases of non-SP


blending or PTP motion, its value will be silently ignored (no error reported).
Short form
BlendEd
Syntax
<motion> <element> <position> BlendEndProtected = <value>
Parameters
<element>: valid motion element

< 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

Move SCARA {10,10,0,0} BlendEd =50


See Also
BLENDMETHOD, BLENDSTARTPROTECTED, BLENDPERCENTAGE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 47 / 415


MC-Basic Commands 2.7

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.

The advanced interpolation blending will blend a series of motion instructions


as waypoints, and eventually performing only one complete motion.
NOTE
Note that by changing BlendMethod value from 2 to any other (0,1) clears all
previously stored points of AI path.
Syntax
? <element>.BlendMethod

<element>.BlendMethod= <value>
Domain
ELEMENT
Parameters
<element>: valid motion element

< value >: Long, Blend Mode


Limitations
In case of AI :

If other motion commands are entered (CIRCLE) an error will be returned and
the command will be not executed.

If modal value of starttype is set to immediate or super immediate an error will


be returned.
Examples
Axis

A1.BlendMethod = 1

?A1.BlendMethod
Robot

SCARA. BlendMethod = 1

?SCARA.BlendMethod
See Also
BLENDSTARTPROTECTED, BLENDENDPROTECTED,
BLENDPERCENTAGE, MOVE, CIRCLE, MOVES, BLENDDISTANCE,
DOUBLEMODEPERCENTAGE, BLENDORIENTATION

48 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

BLENDORIENTATION
Description
Set the distance of a movement in terms of orientation that will be blended
with the next movement.

This parameter is only applicable to cartesian motion, not to a joint motion. It


specifies a desired value by the user, however it cannot be always
guaranteed, because the actual blending distance depends on the second
motion length as well. In addition, the user is allowed to give any value no less
than zero, but internally it will be limited to the half-length (both translation and
orientation) of the movement in the blending calculation.
NOTE
If value is bigger than maximum variation of orientation, use maximum allowed
value.

BlendOrientation has a higher priority than BlendPercentage, if BlendOrienta-


tion is set, BlendPercentage will be covered. If set BlendDistance and Blend-
Orientation at the same time, robot will start blend motion depending on the
condition which is triggered first.

Applicable only with BlendMethod = 1 (SP blending). In cases of non-SP


blending or PTP motion, its value will be silently ignored (no error reported).
Short form
BlendOri
Syntax
<motion> <element> <position> BlendOrientation = <value>
Parameters
<element>: valid motion element

< value >: Double, the robot orientation during the motion blending, 0 to
Maxdouble, unit is degree
Limitations
Nodal-only
Examples
Axis

Move A1 10 BlendOrientation =50


Robot

Move SCARA {10,10,0,0} BlendOri =50


See Also
BLENDMETHOD, BLENDDISTANCE, BLENDDISTANCE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 49 / 415


MC-Basic Commands 2.7

BLENDPERCENTAGE
Description
Set the Percentage of the movement’s length that will be blended with the
next movement.

0% – no blending at all

100% – blending starts at the middle point of the first motion.

works for BLENDMETHOD - 1(SP).


Short form
<element>.Blend
Syntax
<element>.BlendPercentage= <value>
Domain
ELEMENT
Parameters
<element>: valid motion element

< value >: Double, Percentage of the movement’s length to be blended, 0 to


100
Examples
MOVE SCARA P1 BlendPercentage = 100

SCARA.Blend = 0 ‘Set SCARA no blend


See Also
BLENDMETHOD, MOVE, CIRCLE, MOVES, JUMP, JUMP3, JUMP3CP,
BLENDENDPROTECTED, BLENDSTARTPROTECTED, BLENDDISTANCE,
BLENDORIENTATION

50 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

BlendStartProtected has a higher priority than BlendDistance and BlendOrien-


tation, if BlendStartProtected is set (not 0), the start part of current motion will
not blend with next motion and the end part of current motion will be blended
with previous motion partly.
NOTE
If the value is bigger than path length, use path length instead, 0 means
nothing is protected.

Applicable only with BlendMethod = 1 (SP blending). In cases of non-SP


blending or PTP motion, its value will be silently ignored (no error reported).
Short form
BlendSt
Syntax
<motion> <element> <position> BlendStartProtected = <value>
Parameters
<element>: valid motion element

< 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

Move SCARA {10,10,0,0} BlendSt = 0


See Also
BLENDMETHOD, BLENDENDPROTECTED, BLENDPERCENTAGE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 51 / 415


MC-Basic Commands 2.7
C

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

Call Move_X ‘[Do 10 incremental moves]

End Program
See Also
SUB_..._END_SUB, PROGRAM_..._END_PROGRAM

52 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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>)

<joint_variable> = castjoint (<double_scalar_expression>, <long_expression>)

<joint_variable> = castjoint (<long_array>, <long_expression>)

<joint_variable> = castjoint (<double_array>, <long_expression>)


Parameters
<long_expression>: specify the type that user want to cast

Contains: TYPE_XY, TYPE_XYZ, TYPE_XYR, TYPE_XYZR, TYPE_XYZABC,


TYPE_XYZYPR…

See Point_Type_List

<long_scalar_expression >: Long, specify the coordinate values

<double_scalar_expression>: Double, specify the coordinate values

<long_array>: Long Array, specify the coordinate values

<double_array>: Dobule Array, specify the coordinate values


Return Value
Returns a generic joint type of point.
Limitations
Only a single-dimension array can be used as argument.

Number of array elements must be equal or greater than number of


coordinates.
Examples
GenJoint = CASTJOINT(1, TYPE_XYZ)

? CASTJOINT(ArrayOf4Doubles, TYPE_XYZR)
See Also
CASTPOINT, CASTLOCATION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 53 / 415


MC-Basic Commands 2.7

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>)

<location_variable> = castlocation (<double_scalar_expression>,


<long_expression>)

<location_variable> = castlocation (<long_array>, <long_expression>)

<location_variable> = castlocation (<double_array>, <long_expression>)


Parameters
<long_expression>: specify the type that user want to cast

Contains: TYPE_XY, TYPE_XYZ, TYPE_XYR, TYPE_XYZR, TYPE_XYZABC,


TYPE_XYZYPR…

See Point_Type_List

<long_scalar_expression >: Long, specify the coordinate values

<double_scalar_expression>: Double, specify the coordinate values

<long_array>: Long Array, specify the coordinate values

<double_array>: Dobule Array, specify the coordinate values


Return Value
Returns a generic location type of point.
Limitations
Only a single-dimension array can be used as argument.

Number of array elements must be equal or greater than number of


coordinates.
Examples
GenLocation = CASTLOCATION(0.5, TYPE_XYZ)

? CASTLOCATION(ArrayOf6Longs, TYPE_XYZR)
See Also
CASTPOINT, CASTJOINT

54 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<long_expression>: specify the type that user want to cast

Contains: TYPE_XY, TYPE_XYZ, TYPE_XYR, TYPE_XYZR, TYPE_XYZABC,


TYPE_XYZYPR…

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)

? CASTPOINT(#{0.0, 0.0, 0.0, 1.0}, TYPE_XYZR)


See Also
CASTJOINT, CASTLOCATION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 55 / 415


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
PRINT CHR$(65)

Prints the following: A


See Also
SPACE$, STRING$, UTF$, ASC, STRL$

56 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

{Until <Signal> = <StopCondition>}

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>}

Circle {ROBOT} CirclePoint TargetPoint { 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>}
Parameters
<ROBOT>: any valid robot. Here can use a blank or write SCARA.

Angle: specify how many degrees to circle, Double

CircleCenter: specify the circle center, Joint or Location

CirclePlane: defined in which plane the circle interpolation will be done,


Double, 0,1,2, Default = 0

0 (XY)

1 (XZ)

2 (YZ)

For circular(arc) path

CirclePoint: define the supplement point of arc, Joint or Location

TargetPoint: define the enf point of arc, Joint or Location


<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.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 57 / 415


MC-Basic Commands 2.7

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°.

<Blendstartprotected>:blend start point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from start point to the specified point, the priority is
higher than BlendDistance and BlendOrientention.

If Blendstartprotected set value is larger than 0, then this trajectory will not
blend with last trajectory.

<Blendendprotected>:blend end phase protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from the specified point to the end point, the priority
is higher than BlendDistance and blendOrientention.

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.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

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

58 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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, used as a condition for interruption.

<Abs>: Absolute. This property is used to define whether input target point is
absolute position or relative position.

In absolute position mode, position commend of element is the needed


absolute position. In relative position mode, position command is needed
position changes. Value 0 represents relative position, and value 1 represents
absolute position. If not set, default value is 1.

<VTRAN>: VELOCITYTRANS, translation velocity of motion arc, unit


mm/sec.

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.

<ATRAN>:ACCELERATIONTRANS, translation acceleration of the motion


arc, unit mm/sec2.

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.

<DTRAN>:DECELERATIONTRANS, translation deceleration of the motion


arc, unit mm/sec2.

When executing motion command, deceleration should smaller than or equals


to system maximum translation deceleration. If the property is larger, the
system maximum translation deceleration should be used to execute motion.

<JTRAN>:JERKTRANS, translation jerk of the robot motion. Jerk refers to


the rate of change of acceleration.

<VROT>: VELOCITYROT, rotation velocity of the motion arc, unit


degree/sec.

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.

<AROT>:ACCELERATIONROT, rotation acceleration of the motion arc, unit


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.

<DROT>: DECELERATIONROT, rotation deceleration of the motion arc, unit


degree/sec2.

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.

<JROT>:JERKROT, rotation jerk of the robot. Jerk refers to rate of change


of acceleration.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 59 / 415


MC-Basic Commands 2.7

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.

Circle SCARA CirclePoint = {10,20,0,0} TargetPoint = {100,200,0,0}


WithPls=PT_1 ‘ Add position trigger.

Circle SCARA CirclePoint = {10,20,0,0} TargetPoint = {100,200,0,0} Until


SIGNAL1=on ‘ Add Unitl interrupt function, triggered when SIGNAL1 is on.

Move PL1 Armcmd=1 ‘Specify current armcmd in Move command

Circle SCARA Angle = 90 CircleCenter = #{700,0,0,0} VTran=200

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


VTran = 500 ‘Set translation velocity

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


ATran = 500 ‘Set translation acceleration

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


JTran = 500 ‘set translation jerk

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


VRot = 500 ‘set rotation velocity

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


ARot= 500 ‘set rotation acceleration

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


JRot = 500 ‘set rotation jerk

Example program is as follow, where target point should be created by user:

Program

Attach

Move PL1 Armcmd=1

Circle SCARA Angle = 90 CircleCenter = #{700,0,0,0} VTran=200 ATran=1000


JTran=5000 Blend=50

Moves PL2 Blend=100 VTran=1000

60 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Move PL1 VScale=50

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}


VTran = 500 Until signal1 = Off

Move PL1 VScale=50

Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,300,-100,100}


VRot = 500 ARot=1000 WithPls=PT_1

Move PL3

Circle SCARA Angle = 90 CircleCenter = #{700,0,0,0} CirclePlane=1 VTran=200


ATran=1000 JTran=5000 Blend=50

Detach

end program

Move SCARA #{100,0,0,0}

Circle Angle = 180 CircleCenter = #{50, 0, 0, 0}Vtran = 500 CirclePlane =


PLANE_XY

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 61 / 415


MC-Basic Commands 2.7

CLEARMSG
Description
Clear all the message logs.
Syntax
ClearMsg()
Examples
Program

?33

ClearMsg()

?55

End Program

The result will be printed as follow:

55
See Also
PRINT

62 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Long, 0 to MaxLong


Limitations
Read only
Examples
?System.Clock

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 63 / 415


MC-Basic Commands 2.7

CLOSE
Description
Releases a file handle and closes the file.

< FileHandle >: a file handle


Syntax
Close #<FileHandle>
Parameters
< FileHandle >: Long
Limitations
Write only
Examples
Close #filehandle

Filehandle is band by open file command.


See Also
OPEN_FILE, INPUT$, LOC, ACCEPT, CONNECT, IPADDRESSMASK,
OPENSOCKET, PING, PRINT_HASH, PRINTPOINTUSING, PRINTTOBUFF,
PRINTUSING, PRINTUSING$, PRINTUSING_HASH-SIGN,
PRINTUSINGTOBUFF

64 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

System constants are defined through the Common Shared command in


configuration file (before program block), user tasks (before program block)
and terminal. These variables have system-wide visibility. All tasks may use
the variables and the variables may be used to coordinate activities among
tasks.

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.

Variables must be one of three types.


Syntax
Common Shared | Dim Shared | Dim <name> As {Const} Long =
<const_value>
Parameters
{ Const } : Optional Keyword to set variable as a constant variable

<name>: variable name user specify

<const_value>:initial value, Long


Limitations
Arrays and subroutine or function definitions (parameters and return values)
are not supported.

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

Dim Shared DL as Long = CLConst

Program

Dim Integer1 as Long = DL

Dim xFlag as Long = True

End Program

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 65 / 415


MC-Basic Commands 2.7

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.

System constants are defined through the Common Shared command in


configuration file (before program block), user tasks (before program block)
and terminal.

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

<name>: variable name user specify

<const_value>:initial value, Double


Limitations
Arrays and subroutine or function definitions (parameters and return values)
are not supported.

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

Dim Shared DD as Double = CDConst

Program

Dim myvar as Double = DD

End Program

66 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

COMMON_OR_DIM_SHARED_OR_DIM_..._AS_STRING
Description
These commands are used to define user variables as STRING type.

System constants are defined through the Common Shared command in


configuration file (before program block), user tasks (before program block)
and terminal. These variables have system-wide visibility. All tasks may use
the variables and the variables may be used to coordinate activities among
tasks.

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.

Variables must be one of three types.


Syntax
Common Shared | Dim Shared | Dim <name>As {Const} String { of UTF8 } =
<const_value>
Parameters
{ Const } : Optional Keyword to set variable as a constant variable

{ of UTF8 }: Optional Keyword to set String as UTF-8 encoding

<name>: variable name user specify

<const_value>:initial value, String


Limitations
Arrays and subroutine or function definitions (parameters and return values)
are not supported.

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”

Dim Shared DD as String = CDConst

Program

Dim myvar as String of UTF-8

myvar = UTF$(1000) + UTF$(500)

End Program
See Also
UTF$, CHR$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 67 / 415


MC-Basic Commands 2.7

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.

System constants are defined through the Common Shared command in


configuration file (before program block), user tasks (before program block)
and terminal. These variables have system-wide visibility. All tasks may use
the variables and the variables may be used to coordinate activities among
tasks.

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.

Variables must be one of three types.

A position given in joint coordinates is an array of n joint values:

{jnt1, jnt2, jnt3, jnt4, jnt5, jnt6}


Syntax
Common Shared | Dim Shared | Dim <name>As {Const} Joint of <
robot_type > = <const_value>
Parameters
{ Const } : Optional Keyword to set variable as a constant variable

<name>: name user specify

<const_value>:initial value, Joint

<robot_type>: Robot type

According to the Point_Type_List


Limitations
Arrays and subroutine or function definitions (parameters and return values)
are not supported.

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}

Dim Shared DJ as Joint of XYZR

Program

Dim myjoint as Joint of XYZR = CJConst

68 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

End Program

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 69 / 415


MC-Basic Commands 2.7

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.

System constants are defined through the Common Shared command in


configuration file (before program block), user tasks (before program block)
and terminal. These variables have system-wide visibility. All tasks may use
the variables and the variables may be used to coordinate activities among
tasks.

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.

Variables must be one of three types.

A position given in Cartesian coordinates is an array preceded by the "#" sign,


to differentiate between joint and location positions:

#{x_value, y_value, z_value, yaw_value, pitch_value, roll_value}


Syntax
Common Shared | Dim Shared | Dim <name>As {Const} Location of <
robot_type > = <const_value>
Parameters
{ Const } : Optional Keyword to set variable as a constant variable

<name>: name user specify

<const_value>:initial value, Location

<robot_type>: Robot type

According to the Point_Type_List


Limitations
Arrays and subroutine or function definitions (parameters and return values)
are not supported.

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}

Dim Shared DL as Location of XYZR

Program

70 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Dim mylocation as Location of XYZR = CLConst

End Program

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 71 / 415


MC-Basic Commands 2.7

COMMON_OR_DIM_SHARED_..._AS_NOTE_OR_ERROR_ASCII_NU
MBER
Description
Creates a user exception and defines a corresponding error message.

An exception may be declared at either the system or task levels.

The interpreter and error handler processes an application exception as it


does with any other internal error or note.

The application exception may be trapped with TRY/CATCH, ONERROR or


ONSYSTEMERROR, and the system responds by stopping the task or motion
according to the exception severity.

You can specify an exception number from 22000 to 22498.

If no exception number is specified, the system assigns an arbitrary numeric


value within the range 22499 to 22999. Do not assume this value will be the
same from load to load.
NOTE
System has already defined many errors, the user error should not have the
same number as system error.
Syntax
common shared <name> as error "<message>" [number]

dim shared <name> as error "<message>" [number]

common shared <name> as note "<message>" [number]

dim shared <name> as note "<message>" [number]


Parameters
<name> : name user specify

<message>: the exception message to be printed when the exception is


invoked, String

[number] : the number of the error or note


Limitations
Severity may be only Note or Error.

The exception number must be unique.

Array and subroutine definitions are not supported


Examples
Common Shared MyErr as Error ‘"App Error" 22001

common shared err as error ‘"My Error"


See Also
LOGGER, THROW, NUM, MSG

72 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 73 / 415


MC-Basic Commands 2.7

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:

<structure_name>-><structure element name> =<expression>

Query single element of a structure syntax :

? <structure_name>-><structure element name>

Define the structure:

COMMON SHARED|DIM SHARED|DIM <structure_name> AS <structure


type>

For arrays of structures:

COMMON SHARED|DIM SHARED|DIM <structure_name>[ ]… AS <structure


type>
Parameters
<Structure type> : is the declared structure type

<structure_name>: defined type variable

<structure element name>: structure element variable


Limitations
Write only. Structure type must be pre-defined in configuration file.
Examples
In config file ->

Type X

L1 as Long

Length as Long

End Type

In application file ->

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 75 / 415


MC-Basic Commands 2.7

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

<port number>: TCP port, Long

<ip address>: string, IP address

<timeout>: Long
Limitations
Task only
Examples
OpenSocket Options=1 as #200

Connect(#200,"127.0.0.1",6002)

print Input$(LOC(200), #200)

close #200
See Also
CLOSE, OPENSOCKET, ACCEPT, PING, IPADDRESSMASK

76 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

CONTINUEPATH will start from the next motion command stored in


STOPPATH. This command can be used together with the command
STOPPATH.
NOTE
CONTINUEPATH can only be used after executing STOPPATH.

If CONTINUEPATH is used in an event, please pay attention to the timing of


the command execution. The resumed motion trajectory will be recalculated
based on new data such as the starting position and blending stop reason,
and the new calculated trajectory may be completely different from the
previous one.
Short form
Continuepath
Syntax
Continuepath < robot | axis>
Parameters
< robot | axis>: any valid robot or axis
Limitations
Write only
Examples
Continuepath SCARA
See Also
RECOVERPATH

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 77 / 415


MC-Basic Commands 2.7

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

78 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 79 / 415


MC-Basic Commands 2.7

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

<value>: Double, 0 to MAXDouble


Return Value
returns the cumulative change in the position value of an axis, in absolute
values

<return value> : Double, 0 to MAXDouble


Examples
A1.CumulativePosition = 0

?A1.CumulativePosition

80 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Long


Limitations
Read only
Examples
Axis

?A1.CAb
Robot

?SCARA.CAbs
See Also
ABSOLUTE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 81 / 415


MC-Basic Commands 2.7

CURRENTTIME
Description
Returns the total time of the currently executing motion. Values:

-1 = No motion active

-2 = Not applicable (PrfType = 0 or 1)

> 0 = Current time of running motion


NOTE
Note that in case of blending the TotalTime/CurrentTime of the first motion of
the blending pair is returned! Once the blending ceased (only the second
motion is executing, i.e. the first movement finished) the time values of the
second motion are returned.
Short form
element.Ctime
Syntax
?<element>Ctime
Domain
ELEMENT
Parameters
<element>: valid motion element
Return Value
Returns the total time of the currently executing motion

<return value>: Long, -2…MaxInt


Limitations
Read-only
Examples
Axis

?A1.currenttime
Robot

?SCARA.currenttime

82 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
D

DECELERATION
Description
This property sets the deceleration rate of the motion profile.

When executing a motion command, deceleration should be less than or


equal to DECELERATIONMAX. If it is greater, the motion is executed at the
DECELERATIONMAX value.

This property can be used inside a motion command to override the


permanent value.
Short form
<element>.Dec
Syntax
<element>.Deceleration = <expression>

?<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:

Jerk/Dec < 0.9 × π/5T

where T is the sample time in seconds.

For a cycle time of 2 milliseconds, this value is 282.74. Use


SMOOTHFACTOR to have jerk calculated automatically.

To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis

A1.deceleration = 1e10

Move A1 100 dec = 2e10


Robot

SCARA.deceleration = 1e10

Move SCARA {100, 20,0,0} dec = 2e10


See Also
DECELERATIONMAX, ACCELERATION, ACCELERATIONSCALE, JUMP,
MOVE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 83 / 415


MC-Basic Commands 2.7

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

84 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

The value cannot be greater than ACCLERATIONMAXROT. The system


always takes the smaller of the two with a notification message sent to the
user.
Short form
<ROBOT>.drot
Syntax
<ROBOT>.drot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal/Nodal
Examples
drot = 6000
See Also
CIRCLE, MOVES, DECELERATIONTRANS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 85 / 415


MC-Basic Commands 2.7

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).

The value cannot be greater than DECLERATIONMAXTRANS. The system


always takes the smaller of the two with a notification message sent to the
user.
Short form
<ROBOT>.dtran
Syntax
<ROBOT>.dtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal/Nodal
Examples
dtran = 6000
See Also
CIRCLE, MOVES, DECELERATIONROT

86 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

Files that are protected by a password may not be deleted.


Examples
Delete FILE1.PRG
See Also
DELETE$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 87 / 415


MC-Basic Commands 2.7

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.

Files that are protected by a password may not be deleted.


Examples
Delete$ “File1.PRG”

Or

Common shared FName as string = ““File1.PRG”

Delete$ FName
See Also
DELETE

88 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 89 / 415


MC-Basic Commands 2.7

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.

DEPPOINT is always used with RECOVERPATH command.


Syntax
<point_variable> = <elementName>.deppoint

? <element_name>.deppoint
Domain
ELEMENT
Parameters
< elementName >: valid motion element
Return Value
Return the cartesian value of deppoint

< point_variable >: Location


Limitations
Read only

Can only be used after the STOPPATH command is completed.


Examples
Axis

P1= A1.Deppoint

?A1.Deppoint
Robot

P1= Scara.Deppoint

?Scara.Deppoint

90 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< point_variable >: Location


Limitations
Modal Only, Read only . Proceed command should be used after Stop
command for getting the corrected value .
Examples
Axis

P1= A1.Dest

?A1.Dest
Robot

P1= Scara.Dest

?Scara.Dest
See Also
MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 91 / 415


MC-Basic Commands 2.7

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.

If the detach command is omitted the current motion will be


interrupted(stopped) meaning that final position of the last movement in the
program might be not reached.
Syntax
Detach <element>
Parameters
< element>: Defined motion element
Limitations
Write only. The defined motion element must have been previously attached.
Examples
Detach SCARA
See Also
ATTACH, ATTACHTO$, ATTACHTO, DETACHFROM, ATTACHEDTO,
DETACHFROM$

92 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<element>: Element specification can be axis, group or robot.


Examples
attachto a16 File = ttt.prg

detachfrom a16 File = ttt.prg


See Also
ATTACH, DETACH, ATTACHTO$, ATTACHTO, DETACHFROM$,
ATTACHEDTO

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 93 / 415


MC-Basic Commands 2.7

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.

<elemen name >: Element specification can be axis, group or robot.


Examples
attachto$ a16 File = "ttt.prg"

detachfrom$ a16 File = "ttt.prg"


See Also
ATTACH, DETACH, ATTACHTO$, ATTACHTO, ATTACHEDTO,
DETACHFROM

94 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.”

The default value is calculated:

DISABLETIMEOUT = DISTIME + (VFB-DISSPEED)/DECSTOP

Where:

DISTIME (IDN 207) = Maximum value of Drive Off Delay Time.

VFB (IDN 40) = Maximum value of Velocity Feedback converted to RPM.

DISSPEED (IDN P16) = Minimum value of Active Disable Threshold Speed.

DECSTOP (IDN P87) = Minimum value of Quick Deceleration Rate.

All values are in drive units.


Short form
<axis>.DTimeout
Syntax
?<axis>.DisableTimeout
Domain
AXIS
Parameters
<axis> : any valid axis
Return Value
returns Maximum time the System waits from disabling the drive until the drive
becomes disabled

<return value> : Long, 0 to MaxLong


Examples
?A1.DisableTimeout

A1.DisableTimeout = 10000

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 95 / 415


MC-Basic Commands 2.7

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})

D = DistL (L1, L2)


See Also
DISTR

96 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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})

D = DistR (L1, L2)


See Also
DISTL

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 97 / 415


MC-Basic Commands 2.7

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.

Statements are optional. If none are included, DO…LOOP acts as a delay.


The loop may be executed either while the condition is true, or until the
condition becomes true. This choice is made by using either LOOP UNTIL or
LOOP WHILE.
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
Do

<code to execute>

Loop While | Until <condition>


Examples
Do … Loop Until

Dim Shared I as Long

Program

I=0

Do

I=I+1

Print I

Loop Until I=10

End Program

Do … Loop While

Dim Shared I as Long

Program

Do

I=I+1

Print I

Loop While I<10

End Program
See Also
WHILE_..._END_WHILE, FOR_..._NEXT, PROGRAM_..._END_PROGRAM

98 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

DOUBLEMODE
Description
Queries the DOUBLEMODE interpolation status during blending of two
movements. Possible values are:

0 – blending has not yet started

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

< return value >: Long, 0 or 1


Limitations
Read only
Examples
Axis

?A1.DoubleMode
Robot

?SCARA.DoubleMode
See Also
DOUBLEMODEPERCENTAGE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 99 / 415


MC-Basic Commands 2.7

DOUBLEMODEPERCENTAGE
Description
Queries the actual percentage of the blending during Double Mode.

0 - beginning of blending

100 - finish of blending


Short form
<element>.DoubleModePercentage
Syntax
?<element>.DoubleModePercentage
Domain
ELEMENT
Parameters
<element>: any valid motion element
Return Value
returns the actual percentage of the blending during Double Mode

<return value>: Long, 0 or 100


Limitations
Read only
Examples
Axis

?A1.DoubleModePercentage
Robot

?SCARA.DoubleModePercentage
See Also
BLENDMETHOD, DOUBLEMODE

100 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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[*] >: array of double

< lNum >: the number of double

< lEndian >: data format, 0- small endian (HGFEDCBA), 1-big


endian(ABCDEFGH)
Examples
Dim lArrayData[4] as long

Dim dArrayData[2] as double

dArrayData[1] = 105.56

DoubleToLong (dArrayData, lArrayData,1,0)

?lArrayData[1] result 42096

?lArrayData[2] result 15626

?lArrayData[3] result 55139

?lArrayData[4] result 23104


See Also
FLOATTOLONG, LONGTODOUBLE, LONGTOFLOAT

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 101 / 415


MC-Basic Commands 2.7

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.

"Parameter write failed!" Please check if drive is disabled.

"The current robot does not support enable I2T function"

"The current robot does not support changing I2T function"

"Parameter write successed, please restart the control cabinet!"


See Also
DRIVE_DISABLE_I2T_PROTECTION

102 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

"Parameter write failed!"

"The current robot does not support enable I2T function"

"The current robot does not support changing I2T function"

"Parameter write successed, please restart the control cabinet!"


See Also
DRIVE_ENABLE_I2T_PROTECTION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 103 / 415


MC-Basic Commands 2.7

DRIVETORQUELIMIT
Description
Set maximum drive torque value of singular axis.
Syntax
<element>.DriveTorqueLimit = 50

? <element>.DriveTorqueLimit
Domain
ELEMENT
Parameters
Set maximum drive torque percentage.

<set value>: Double [1-100]


Return Value
Returns maximum drive torque percentage.

<return value>: Double [1-100]


Examples
J1. DriveTorqueLimit = 50

? J1. DriveTorqueLimit

Dim dArrayData[2] as double

dArrayData[1] = 105.56

DoubleToLong(dArrayData, lArrayData,1,0)

?lArrayData[1] => 42096

?lArrayData[2] =>15626

?lArrayData[3] =>55139

?lArrayData[4] =>23104
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
PEAKTORQUE, PEAKVELERR, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT

104 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
E

ELEMENTID
Description
For axis - Returns unique ID of the axis.

For group - Returns ID of the group.


Syntax
? <element>.ElementID
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns ID of the group.

<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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 105 / 415


MC-Basic Commands 2.7

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

106 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Always returns 0 for axis.

Others: 1 to 64
Limitations
Modal Only, Read only
Examples
Axis

n = A1.ElementSize
Robot

m = SCARA.ElementSize
See Also
ELEMENTID, ELEMENTNAME, ELEMENTSTATUS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 107 / 415


MC-Basic Commands 2.7

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.

String returned is in the format:

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

<return value>: String


Limitations
Modal Only, Read only
Examples
Axis

?A1.ElementStatus

Main Program line : 49 File : TJ3.PRG, Library line : 79 File : STAT.LIB


Robot

?SCARA.ElementStatus

Main Program line : 49 File : TJ3.PRG, Library line : 79 File : STAT.LIB


See Also
ELEMENTSIZE, ELEMENTID

108 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
?Error

?MyTask.prg.error
See Also
TASKERROR

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 109 / 415


MC-Basic Commands 2.7

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.

When Sys.ErrorHandlerMode = FALSE (for debug purposes) Only the task


producing the error is idled and motion elements attached to the task stop.
Syntax
Sys.ErrorHandlerMode = <value>

?System. ErrorHandlerMode
Domain
SYSTEM
Parameters
<value>: Long, 0 or 1

0 = FALSE

1 = TRUE
Examples
?Sys.ErrorHandlerMode

Sys.ErrorHandlerMode = 1

110 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 111 / 415


MC-Basic Commands 2.7

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

<condition>: condition that trigger the event

<prio>: priority of the event.

<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

112 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 113 / 415


MC-Basic Commands 2.7

EVENTLIST
Description
List of the names of the existing events and their states. The information is
returned in the following format:

EventName = <event>, State=Running | Stopped | Error, Priority=<priority>,


Owner=<parent task>, Edge=Triggered | UnTriggered, Scan=<scan rate>,
Status = On | Off

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.

If a <task> precedes EVENTLIST, only events belonging to the specified task


are listed.
Syntax
?Eventlist

?<task>.EventList
Parameters
< task >: task name
Return Value
returns the List of the names of the existing events and their states

<Return value>: String


Limitations
Read only
Examples
?EventList

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

114 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 115 / 415


MC-Basic Commands 2.7

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

116 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 117 / 415


MC-Basic Commands 2.7
F

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

<Return value>: Long, 0 to MaxLong


Limitations
Read only
Examples
? FileSize Task1.prg

118 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<Return value>: Long, 0 to MaxLong


Limitations
Read only
Examples
? FileSize$ (“DEMO/APP1/APP1.UPG”)

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 119 / 415


MC-Basic Commands 2.7

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

< dArrayData[*] >: array of float

< lNum >: number of float

< lEndian >: data format, 0- small endian (DCBA), 1-big endian(ABCD)
Examples
Dim lArrayData[4] as long

Dim dArrayData[2] as double

dArrayData[1] = 45.7

FloatToLong(dArrayData, lArrayData,1,0)

?lArrayData[1] result 52684

?lArrayData[2] result 13890


See Also
LONGTOFLOAT, DOUBLETOLONG, LONGTODOUBLE

120 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<start value>: Long, Double, or expression

<end value>: Long, Double, or expression

<stepsize>: Long, Double, or expression, If not entered, it defaults to 1

{<loopstatements>}: the code in loop

<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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 121 / 415


MC-Basic Commands 2.7

dim array1[5][5] as long

dim I as long

For I = 1 to 5

Print I 'Prints 2, 3, 4, 5

Next I

For I=4 To 2 Step –0.5

Print I 'Prints 4.0, 3.5, 3.0, 2.5, 2.0

Next I
See Also
DO_..._LOOP, WHILE_..._END_WHILE, PROGRAM_..._END_PROGRAM

122 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

If use Keyword Public as prefix of FUNCTION_..._END_FUNCTION, function


will be in a global action scope and can be used in any other tasks.
Short form
FUNCTION_..._END_FUNCTION
Syntax
{Public} Function<name>({{ByVal}<p_1> as <type_1>} {,{ByVal}<p_n> as
<type_n>}) As <function type>

{local variable declaration}

{function code}

END Function
Parameters
{Public}: Optional keyword that specifies the scope of function(s)

<name>: function name

{ByVal}: to set the parameter passed by value .

<p_1> and <p_n>: function parameter name

<type_1> and <type_n> : parameter type

<function type>: function return value type

{local variable declaration}: function body to declare the local variable in


function

{function code}: function body


Limitations
Write only. Arrays are only passed by reference.
Examples
Program

?add1(5)

End Program

Function add1(byval a as long) as long

Add1=a+1

End Function' running this program prints 6


See Also
SUB_..._END_SUB, PROGRAM_..._END_PROGRAM

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 123 / 415


MC-Basic Commands 2.7
G

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

124 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 125 / 415


MC-Basic Commands 2.7

GOHOME
Description
This command is used to move group to the HOME position.

HOME position is set in project setting.


Syntax
GoHome(<VelocityScale>)
Parameters
< VelocityScale >: set the velocity scale, Double 0~100; when -1, use default
VelocityScale
Examples
GoHme(100)

126 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

The GOTO statement can be compared to the conditional branching


statements, IF..THEN and SELECT CASE.
Syntax
GOTO <program label>

<program label>:
Parameters
<program label>: program label.
Limitations
Write only.

The label must appear on a line of its own.

Labels may not be repeated within a task.

GOTO command can not be used in TRY … END TRY.

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

<code> ‘ This code block will be skipped, when execute GOTO

Reference1:

<code to be executed after GOTO>

End Program

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 127 / 415


MC-Basic Commands 2.7

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

<numeric expression>: Long, 0 or 1


Limitations
Write-Only, Nodal Only, used for MOVES command only
Examples
Move SCARA #{400,0,0,0}

Moves SCARA #{1000,0,0,0} GoToLimit = 1

' this command will move the robot in positive X direction as far as it can go.
See Also
MOVES

128 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

If {group_name} is specified, the command returns the names of the axes of


that particular group.
Syntax
?GroupList {group_name}
Parameters
{ group_name}: any valid Robot
Return Value
returns a list of the names of the groups that are defined in the system

<return value>: String


Limitations
Read only
Examples
?GroupList

‘returns SCARA: A1, A2, A3, A4


See Also
PLSLIST, AXISLIST, TASKLIST, VARLIST, VARLIST$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 129 / 415


MC-Basic Commands 2.7

GRP_CLOSE_GRIPPER
Description
This command closes the specify gripper.
Syntax
GRP_CLOSE_GRIPPER (<EndEffectorName>, <GripperName>)
Parameters
< EndEffectorName >: any valid EndEffector, String

<GripperName>: any valid Gripper that belongs to below EndEffector, String


Examples
GRP_CLOSE_GRIPPER ("E1","SCARA")
See Also
GRP_OPEN_GRIPPER

130 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

GRP_OPEN_GRIPPER
Description
This command opens the specify gripper.
Syntax
GRP_OPEN_GRIPPER (<EndEffectorName>, <GripperName>)
Parameters
< EndEffectorName >: any valid EndEffector, String

<GripperName>: any valid Gripper that belongs to below EndEffector, String


Examples
GRP_OPEN_GRIPPER ("E1","SCARA")
See Also
GRP_CLOSE_GRIPPER

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 131 / 415


MC-Basic Commands 2.7
H

HERE
Description
Returns the actual robot Cartesian coordinates or axis angle.

This variable is computed each sampling period from the motor feedback
position.

It equals TOCART(PFB). It is a counterpart of SETPOINT.


Syntax
<point_variable> = <element>.here

? < element >.here


Domain
ELEMENT
Parameters
< element >: any valid motion element
Return Value
Returns the actual robot Cartesian coordinates or axis angle

<point_variable>: double or Location


Limitations
Modal only , Read only
Examples
P1= Scara.Here

? Scara.Here

? A1.Here
See Also
POSITIONFEEDBACK

132 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

HEX$
Description
HEX$ returns the string representation of a number in a hexadecimal format.

Letters appear in capital form.


Syntax
HEX$(<number>)
Parameters
<number>: Long, MinLong to MaxLong
Return Value
returns the string representation of a number in a hexadecimal format

<return value>: String


Examples
myStr = Hex$(985421)

?myStr

Prints the following: F094D


See Also
BIN$, STRL$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 133 / 415


MC-Basic Commands 2.7

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()

134 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
I

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

<joint> : any valid joint


Return Value
returns the electric-current command issued by the drive, in user units

<return value> : Double, MinDouble to MaxDouble


Limitations
Read only
Examples
?A1.icmd

?J1.icmd
See Also
IFBK

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 135 / 415


MC-Basic Commands 2.7

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.

A condition is an expression that, when evaluated, is TRUE if the result is not


zero, and FALSE if the result is zero.

The ELSE section is optional, but must be followed by at least one statement.

IF statements may be nested within each other.

There is no ELSE IF command. If you want to place an IF after ELSE, you


must place IF on a new line.
Syntax
IF <condition> THEN

<first statement to execute if condition is true>

<multiple statements to execute if condition is true>

{ELSE

<first statement to execute if condition is false>

<multiple statements to execute if condition is false>}

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

136 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<joint> : any valid joint


Return Value
returns the electric-current feedback measured in the drive, in user units

<return value> : Double, MinDouble to MaxDouble


Limitations
Read only
Examples
?A1.ifbk

?J1.ifbk
See Also
ICMD

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 137 / 415


MC-Basic Commands 2.7

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

call lib1sub(5) 'call one of lib1 subroutines named lib1sub

End Program

138 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
?System.Information
See Also
NAME

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 139 / 415


MC-Basic Commands 2.7

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.

<DeviceHandle>: Long, a handle to the specified serial port or file


Return Value
Returns a string of characters from the specified port or file The return string
length is limited by <length> parameter

<return value>: String


Limitations
Read only
Examples
Str_Var=Input$(50,#1)

Test=Input$(1, #1)

X=Input$(LOC(1), #1)
See Also
CLOSE, LOC, OPEN_FILE, PRINT_HASH, PRINTPOINTUSING,
PRINTUSING, PRINTUSING$, PRINTUSING_HASH-SIGN

140 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<return value>: Long


Limitations
Read only
Examples
?INSTR("file ", ".")

Prints the following: 0

?INSTR("file.exe", "exe")

Prints the following: 6

?INSTR(7,"1-2-3-4-5-6", "-")

Prints the following: 8


See Also
ASC

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 141 / 415


MC-Basic Commands 2.7

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

<return value>: Long


Limitations
Read only
Examples
Value = Int(12.5)

?Int(12.5)

12 ‘returns 12

?Int(-12.5)

-13 ‘ returns -13


See Also
ROUND

142 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

6 = MOVES straight-line movement

7 = DELAY

8 = Advanced interpolation

14 = Torque interpolation

15 = DOPASS

16 = Kino-Dynamic interpolation

17 = Sine Wave 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

<return value>: Long


Limitations
Valid only for groups

Read only

Modal only
Examples
Axis

?A1.Itype
Robot

?SCARA.IType

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 143 / 415


MC-Basic Commands 2.7

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 .

Upon successful setting of IP address by DHCP server, ControlStudio will not


be able to change IP address of controller.
Syntax
Sys.IPAddressMask=<address:mask>

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

<return value>: String


Limitations
Set from Config.prg. Changing of the IP address and/or subnet mask from the
terminal may lead to a lost connection between the controller and
ControlStudio. This is applicable only for Ethernet interfaces. You must close
all open connections before changing the IP address or subnet mask.
Examples
?Sys.IPAddressMask

sys.IPAddressMask="212.25.84.109:255.255.255.128"

Sys. IPAddressMask="dhcp"
See Also
ACCEPT, CLOSE, CONNECT, OPENSOCKET, PING

144 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

ISMOVING
Description
This property indicates whether the motion profiler is active. This flag indicates
the motion profiler phase.

0 – element is not moving

1 – element is at the first motion phase (reaching cruise velocity ). If cruise


velocity is greater than initial velocity, it indicates that the axes are accelerating.

2 – element is at constant velocity phase (cruise)

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:

-1 – When element is a slave (gear or cam) relevant for axis only.

-2 – In drive procedure command (homing, tuning ,...)

-4 – Moving Frame tracking mode (the value is returned unless an incremental


move is issued).
NOTE
The isMoving flag is actually a state variable of an internal state machine,
when sample din events (or recording) it will always indicate state of the next
sample. Therefore a one-sample difference between time measurements
using accelecmd and ismoving can occur.
Syntax
?<element>.IsMoving
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns the flag that indicates whether the motion profiler is active

<return value>: Long, -4, -2 to 3


Limitations
Read only
Examples
Axis

While A1.IsMoving >0

Sleep(10)

End While

waits for profiler to finish


Robot

?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

146 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Long, 0 or 1

0 – Not in position

1 – In position
Limitations
Read only.
Examples
Axis

?A1.IsSettled
Robot

?SCARA.IsSettled
See Also
POSITIONERRORSETTLE, ISMOVING, STARTTYPE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 147 / 415


MC-Basic Commands 2.7
J

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:

Jerk/Acc < 0.9 * π/5T

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

<expression> : Double, rate of change of acceleration


Limitations
JERK has an effect only if SMOOTHFACTOR is set to -1.

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

148 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< numeric expression > : percentage scale, Double, 0.1-100


Limitations
Modal/Nodal

Read/Write
Examples
Axis

A1.japrec = 20
Robot

SCARA.japrec = 20
See Also
JERKDECELERATIONPERCENTAGE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 149 / 415


MC-Basic Commands 2.7

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

< numeric expression > : percentage scale, Double, 0.1-100


Limitations
Modal/Nodal

Read/Write
Examples
Axis

A1.jdprec = 20
Robot

SCARA.jdprec = 20
See Also
JERKACCELERATIONPERCENTAGE

150 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 151 / 415


MC-Basic Commands 2.7

JERKMAXROT
Description
Defines the maximum rotation jerk of the robot. Used for limiting JROT. The
value limits only the Cartesian motion interpolations (MOVES, CIRCLE).

This parameter does not affect joint interpolated movements (MOVE).


Short form
<ROBOT>.jmrot
Syntax
<ROBOT>.jmrot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal Only
Examples
jmrot = 6000
See Also
CIRCLE, MOVES

152 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

JERKMAXTRANS
Description
Defines the maximum translation jerk of the robot. Used for limiting JTRAN.
The value limits only the Cartesian motion interpolations (MOVES, CIRCLE).

This parameter does not affect joint interpolated movements (MOVE).


Short form
<ROBOT>.jmtran
Syntax
<ROBOT>.jmtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Read/Write, Modal Only
Examples
jmtran = 6000
See Also
CIRCLE, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 153 / 415


MC-Basic Commands 2.7

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

<numeric expression>: int, 0.1 to Maxdouble


Limitations
Modal/Nodal
Examples
jrot = 6000
See Also
CIRCLE, MOVES

154 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

The value cannot be greater than JERKMAXTRANS. The system always


takes the smaller of the two with a notification message sent to the user.
Short form
<ROBOT>.jtran
Syntax
<ROBOT>.jtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Modal/Nodal
Examples
jtran = 6000
See Also
MOVES, CIRCLE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 155 / 415


MC-Basic Commands 2.7

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).

The value can only be 0 or 1.

0 – Select the point angle closest to the starting point.

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

<numeric expression>: int, only 0 or 1.


Limitations
Modal/Nodal
Examples
jofollow = 1
See Also
JUMP, JUMP3, MOVE

156 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

Point 4 is the start point of Jump motion, point 3 is Target 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.
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.

For example, Cartesian #{0, 0, 0, 0} or Joint {0,0,0,0}.

<Limiz>:Limit height of the up phase of arch-shaped motion, 0 by default.


Set as-100 indicates after the up motion of arch-shaped motion reached -
100mm, across motion will start. Settings can be based on actual
requirements.

<ArchNo >:Can be set in ArchSettings of ProjectSetting, where AscendingZ


is the distance from start point that needs protection to avoid blending,
DescendingZ is the distance of down phrase that needs protection from
blending, which is calculated from end point.

<VScale>: VelocityScale, velocity percentage, range 0 – 100%.

Velocity parameter is limited by maximum value (defined by user). If not


defined, value set in project setting will be used.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 157 / 415


MC-Basic Commands 2.7

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.

<AScale>:acceleration percentage, range 0 – 100%.

acceleration parameter is limited by maximum (defined by user). If not


defined, value set in project setting will be used.

<Armcmd>:Armcmd of robot

This flag defines the method to reach target position through joint frame. 0:
automatic, 1: left armcmd, 2: right armcmd.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

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.

<Acc>: Acceleration. Acceleration of the motion arc, unit mm/sec2。

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.

<Dec>:Deceleration. Deceleration of the motion arc, unit mm/sec2。

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.

<Jerk>:jerk of the robot motion. Jerk refers to the rate of change of


acceleration.

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.

Jump SCARA #{500,0,-200,0} ArchNo=1 LimZ=-100 Blend=50 Until signal1 =


On‘Add Unitl interrupt function, triggered when SIGNAL1 is on.

Note: The LimZ height should larger than the height of start point and end
point coordinates.

Jump SCARA PL1 ArchNo=1 LimZ=0 Acc=7000 ‘Set acceleration

Jump SCARA PL1 ArchNo=1 LimZ=0 Dec=7000 ‘Set deceleration

Jump SCARA PL1 ArchNo=1 LimZ=0 Jerk=7000 ‘Set jerk

Example program is as follow, where target point should be created by user:

program

Attach

Move PL1 VScale=20 Armcmd=1

Jump SCARA PL2 ArchNo=1 LimZ=0 Blend=50 VScale=100 AScale=20


WithPls=PT_1

Moves PL3 VScale=15 Blend=10 AScale=20

Jump SCARA PL2 ArchNo=1 LimZ=-50 Blend=50 VScale=100 AScale=20


Until signal1 =On Armcmd=2

Move SCARA #{10,10,0,0} abs=0 VScale=20 Blend=10

Move {10,0,-20,0} VScale=30 abs=0

Detach

end program

See Also
JUMP3, JUMP3CP, VELOCITYSCALE, ACCELERATION, DECELERATION,
JERK, STARTTYPE, WITHPLS, BLENDPERCENTAGE, MOVE, VSMODE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 159 / 415


MC-Basic Commands 2.7

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.

Point 4 is the start point of Jump3 motion, point 3 is Target 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.

AscendingPoint: the end position of the ascending path, Cartesian or Joint. It


can use clarified variables as input, or directly input position value. For
example, Cartesian #{0, 0, 0, 0} or Joint {0,0,0,0}.

DescendingPoint: the start position of the descending path, Cartesian or Joint.


It can use clarified variables as input, or directly input position value.

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.

<ArchNo >:Can be set in ArchSettings of ProjectSetting, where AscendingZ


is the distance from start point that needs protection to avoid blending,

160 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

DescendingZ is the distance of down phrase that needs protection from


blending, which is calculated from end point.

<VScale>: VelocityScale, velocity percentage, range 0 – 100%.

Velocity parameter is limited by maximum value (defined by user). If not


defined, value set in project setting will be used.
<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.
<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°,
when BlendOrientation=20, it indicates that when the orientation angle is 70°,
the remaining 20°orientation will blend with that of the next motion command.
Defined maximum value will not exceed the half of total rotation, that is, 45°.

<Blendstartprotected>:blend start point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from start point to the specified point, the priority is
higher than BlendDistance and blendOrientention.

If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.

<Blendendprotected>:blend end point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from the specified point to the end point, the priority
is higher than BlendDistance and blendOrientention. If Blendendprotected is
set larger than 0, 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.

<AScale>:acceleration percentage, range 0 – 100%.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 161 / 415


MC-Basic Commands 2.7

acceleration parameter is limited by maximum (defined by user). If not


defined, value set in project setting will be used.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

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.

<Acc>: Acceleration. Acceleration of the motion arc, unit mm/sec2.

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.

<Dec>:Deceleration. Deceleration of the motion arc, unit mm/sec2.

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.

<Jerk>:jerk of the robot motion. Jerk refers to the rate of change of


acceleration.

<ATRAN>:ACCELERATIONTRANS, translation acceleration of the motion


arc, unit mm/sec2.

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.

<DTRAN>:DECELERATIONTRANS, translation deceleration of the motion


arc, unit mm/sec2.

When executing motion command, deceleration should smaller than or equals


to system maximum translation deceleration. If the property is larger, the
system maximum translation deceleration should be used to execute motion.

<JTRAN>:JERKTRANS, translation jerk of the robot motion. Jerk refers to


the rate of change of acceleration.

<VROT>: VELOCITYROT, rotation velocity of the motion arc, unit


degree/sec.

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.

<AROT>:ACCELERATIONROT, rotation acceleration of the motion arc, unit


162 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7

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.

<DROT>: DECELERATIONROT, rotation deceleration of the motion arc, unit


degree/sec2.

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.

<JROT>:JERKROT, rotation jerk of the robot. Jerk refers to rate of change


of acceleration.

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

Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =


PL3 ArchNo = 1 Vtran = 1000 Until signal1 = On ‘Add Unitl interrupt function,
triggered when SIGNAL1 is on

Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =


PL3 ArchNo = 1 Vtran = 1000 Atran = 5000 ‘Set translation velocity and
acceleration

Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =


PL3 ArchNo = 1 VRot= 1000 ARot = 5000 ‘Set rotation velocity and
acceleration

program

Attach

Move PL4 VScale=20 Armcmd=1

Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =


PL3 ArchNo = 1 Vtran = 1000 AScale = 20 WithPls=PT_1

Move PL4 VScale=15 Blend=10 AScale=20

Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =


PL3 ArchNo = 1 Vtran = 1000 Until signal1 = On

Move PL4 VScale=15 Blend=10 AScale=20

Jump3 SCARA AscendingPoint = #{600,-200,-100} DescendingPoint =


#{600,200,-80,50} TargetPoint = #{600,200,-200,60} ArchNo = 1 VRot= 1000
ARot = 5000 BlendDistance=10 Armcmd=2

Moves SCARA #{20,30,0,0} abs=0 VScale=20 Blend=10

Move {0,0,0,0} VScale=20

Detach

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 163 / 415


MC-Basic Commands 2.7

end program
See Also
JUMP, JUMP3CP, VELOCITYTRANS, JERK, STARTTYPE, WITHPLS,
BLENDPERCENTAGE, VSMODE , BLENDPERCENTAGE,
BLENDSTARTPROTECTED , BLENDORIENTATION

164 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

down movement phase.

Jump3cp motion is shown in the above figure. Point 6 and point 1 are
Ascending Point and the Descending Point.

Point 4 is the start point of Jump3cp motion, point 3 is Target 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.

AscendingPoint: the end position of the ascending path, Cartesian or Joint. It


can use clarified variables as input, or directly input position value. For
example, Cartesian #{0, 0, 0, 0} or Joint {0,0,0,0}.

DescendingPoint: the start position of the descending path, Cartesian or Joint.


It can use clarified variables as input, or directly input position value.

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.

<ArchNo >:Can be set in ArchSettings of ProjectSetting, where AscendingZ


is the distance from start point that needs protection to avoid blending,
DescendingZ is the distance of down phrase that needs protection from

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 165 / 415


MC-Basic Commands 2.7

blending, which is calculated from end point.


<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, it 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.
<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°,
when BlendOrientation=20, it indicates that when the orientation angle is 70°,
the remaining 20°orientation angle will blend with that of the next motion
command. Defined maximum value will not exceed the half of total rotation
degree, that is, 45°.

<Blendstartprotected>:blend start point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from start point to the specified point, the priority is
higher than BlendDistance and blendOrientention.

If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.

<Blendendprotected>:blend end point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from the specified point to the end point, the priority
is higher than BlendDistance and blendOrientention. If Blendendprotected is
set larger than 0, than this trajectory will not blend with last trajectory.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

when configured signal value equals to expected value, the executing motion
will be stopped, and the next motion continues. Until command should be

166 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<VTRAN>: VELOCITYTRANS, translation velocity value of motion arc, unit


mm/sec.

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.

<ATRAN>:ACCELERATIONTRANS, translation acceleration of the motion


arc, unit mm/sec2.

When executing motion command, acceleration 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.

<DTRAN>:DECELERATIONTRANS, translation deceleration of the motion


arc, unit mm/sec2.

When executing motion command, deceleration should smaller than or equals


to system maximum translation deceleration. If the property is larger, the
system maximum translation deceleration should be used to execute motion.

<JTRAN>:JERKTRANS, translation jerk of the robot motion. Jerk refers to


the rate of change of acceleration.

<VROT>: VELOCITYROT, rotation velocity of the motion arc, unit


degree/sec.

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.

<AROT>:ACCELERATIONROT, rotation acceleration of the motion arc, unit


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.

<JROT>:JERKROT, rotation jerk of the robot. Jerk refers to rate of change


of acceleration.

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).

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 167 / 415


MC-Basic Commands 2.7

Examples
Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint
= PL3 ArchNo = 1 Vtran = 1000 WithPls=PT_1 ‘Add position trigger

Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint


= PL3 ArchNo = 1 Vtran = 1000 Until signal1 = On ‘Add Unitl interrupt
function, triggered when SIGNAL1 is on.

Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint


= PL3 ArchNo = 1 Vtran = 1000 Atran = 5000 ‘‘Set translation velocity and
acceleration

Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint


= PL3 ArchNo = 1 VRot= 1000 ARot = 5000 ‘Set rotation velocity and
acceleration

program

Attach

Move PL4 VScale=20 Armcmd=1

Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint


= PL3 ArchNo = 1 Vtran = 1000 WithPls=PT_1

Move PL4 VScale=15 Blend=10 AScale=20

Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint


= PL3 ArchNo = 1 Vtran = 1000 Until signal1 = On

Move PL4 VScale=15 Blend=10 AScale=20

Jump3cp SCARA AscendingPoint = #{600,-200,-100,-30} DescendingPoint =


#{600,200,-80,50} TargetPoint = #{600,200,-200,60} ArchNo = 1 VRot= 1000
ARot = 5000 BlendDistance=10

Moves SCARA #{20,30,0,0} abs=0 VScale=20 Blend=10

Move {0,0,0,0} VScale=20

WaitForMotion

Detach

end program
See Also
JUMP, JUMP3, VELOCITYTRANS, JERK, STARTTYPE, WITHPLS,
BLENDPERCENTAGE, VSMODE, BLENDPERCENTAGE,
BLENDSTARTPROTECTED, BLENDORIENTATION

168 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
L

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

<return value>: String


Limitations
Read only
Examples
PRINT LCASE$(“ FIRST STEP”)

Prints the following: first step


See Also
UCASE$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 169 / 415


MC-Basic Commands 2.7

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

<expression>:the number of characters from the left-hand side of the string ,


Long, 0 to Max length of <string>
Return Value
returns the specified number of characters from the left-hand side of the string

<return value>: String


Limitations
Read only
Examples
Test=”This string is too long”

PRINT LEFT$(Test,4)

Prints the following: This


See Also
MID$, RIGHT$

170 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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("A" + Chr$(0) + "B")

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

<return value>: Long


Limitations
Read only
Examples
? Len (“Hello”)

Prints the following: 5


See Also
SIZE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 171 / 415


MC-Basic Commands 2.7

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

<return value>: Long


Limitations
Read only
Examples
?Loc(1)
See Also
CLOSE, INPUT$, OPEN_FILE, PRINT_HASH, PRINTPOINTUSING,
PRINTUSING, PRINTUSING$, PRINTUSING_HASH-SIGN

172 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<Return value>: Double


Limitations
Read only
Examples
?Log(1)

VaSCARA = Log(Var2)
See Also
EXP

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 173 / 415


MC-Basic Commands 2.7

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

174 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
PRINT “first”;LTRIM$ (“ a left-justified string “)

Prints the following: firsta left-justified string


See Also
RTRIM$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 175 / 415


MC-Basic Commands 2.7

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

< dArrayData[*] >: array of double

< lNum >: number of double

< lEndian >: data format, 0- small endian(DCBA) , 1-big endian(ABCD)


Examples
Dim lArrayData[4] as long

Dim dArrayData[2] as double

lArrayData[1] = 52684

lArrayData[2] = 13890

LongToFloat(lArrayData, dArrayData,1,0)

? dArrayData[1]

Result 45.7
See Also
FLOATTOLONG, DOUBLETOLONG, LONGTODOUBLE

176 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< dArrayData[*] >: array of double

< lNum >: number of double

< lEndian >: data format, 0- small endian(HGFEDCBA) , 1-big


endian(ABCDEFGH)
Examples
Dim lArrayData[4] as long

Dim dArrayData[2] as double

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 177 / 415


MC-Basic Commands 2.7
M

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.

When queried within a function or subroutine of a library, MainFileName will


return the name of the calling task.
Syntax
?<task>.MainFileName

? MainFileName
Domain
TASK
Parameters
<task>: any task in memory
Return Value
returns the original file name of the task

<return value>: String


Limitations
Read Only.Task must be loaded in memory.
Examples
Load$ “Task1.prg” As “Task2.prg”

?Task2.prg.MainFileName

Task1.prg

Or From the Task2.prg:

Program

? MainFileName ‘ should return Task1.prg

End Program
See Also
TASKLIST

178 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

NULL characters are not cut out from strings:

Mid$ gives NULL for the second character:

Val = Mid$("A" + Chr$(0) + "B", 2, 1)

Value of Val is “Chr$(0)”


Syntax
MID$(<string>, <start>, <number>)
Parameters
<string>: String, String to be processed

<start>: Long, start location in string

<number>: Long, cut length


Return Value
returns the specified number of characters from the string, starting at the
character at position <start>

<return value>: String


Limitations
Read only.
Examples
MID$("Hello", 2, 3)

Prints the following: ell


See Also
LEFT$, RIGHT$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 179 / 415


MC-Basic Commands 2.7

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.

If MOTION switches to 0 (OFF), any motion currently in progress is aborted


and any motion in the motion buffers is flushed. The drive can be enabled if
MOTION is off.

In addition to the <element>.MOTION flag, the SYSTEM.MOTION flag must


also be ON in order for motion to be commanded.
Short form
<element>.Motion
Syntax
<element>.Motion = <value>

?<element>.Motion
Domain
ELEMENT
Parameters
< element >: valid motion element

< value > : Long, 0 , 1

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

180 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< value > : Long, 0 , 1

0 = OFF

1 = ON
Examples
Axis

A1.MotionOverLap = 1

?A1.MotionOverLap
Robot

SCARA.MotionOverLap = 1

?SCARA.MotionOverLap
See Also
WAITFORMOTION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 181 / 415


MC-Basic Commands 2.7

MOVE
Description
Executes point-to-point moves from current position to target position of a
single axis or a group of axes.

When using this command on robot groups it will make joint-interpolated


move. If you want to make straight line motion you need to use MOVES
command.
Syntax
Move {ROBOT} Target point {VScale=<value>} {Blend=<value>}
{AScale=<value>} {Armcmd=<value>} {WithPls=<value>} {Until
<signalName>=<value>} {Abs=<value>} {Acc=<value>} {Dec=<value>}
{Jerk=<value>}
Parameters
<ROBOT>: any valid axis or Robot. If motion element is robot, then here can
use a blank or write SCARA. If motion element is single axis, the format
should be J<x>, where <X> is the code of operating axis, for example, J1
represents axis 1.

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.

For example, Cartesian #{0, 0, 0, 0} or Joint {0,0,0,0}.

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.

MOVE command must specified target point.

<VScale>: VelocityScale, velocity percentage, range 0 – 100%.

Velocity parameter is limited by maximum value (defined by user). If not


defined, value set in project setting will be used.

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.

<AScale>:acceleration percentage, range 0 – 100%.

Acceleration parameter is limited by maximum (defined by user). If not


defined, value set in project setting will be used.

182 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

<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.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

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.

Under absolute position mode, position commend of element is the needed


absolute position. Under relative position mode, position command is needed
position changes. Value 0 represents relative position, and value 1 represents
absolute position. If not set, default value is 1.

<Acc>: Acceleration. Acceleration of the motion arc, unit mm/sec2。

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.

<Dec>:Deceleration. Deceleration of the motion arc, unit mm/sec2。

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.

<Jerk>:jerk of the robot motion. Jerk refers to the rate of change of


acceleration.

It is obvious to smooth motion arc with jerk. Generally, it is more convenient to


use SmoothFactor to set smoothness applied in motion arc. SmoothFactor
allows user to set jerk clearly. Jerk is calculated internally in accordance with
SmoothFactor.

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).

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 183 / 415


MC-Basic Commands 2.7

Examples
Move PL1 ‘Cartesian or Joint, all parameters use default value

Move #{370.242, -151.397, -50, -22.24} ‘Enter Cartesian coordinate position


manually

Move {20.837, 9.3, -50, 0} ‘Enter Joint position manually

Move J1 40 ‘Execute single axis motion only

Move PL2 Blend=35 ‘Add blend property

Move PL1 VScale=50 ‘Adjust velocity percentage

Move PL2 AScale=40 ‘Adjust acceleration percentage

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.

In addition, as Blend is achieved based on velocity vector superposition of two


motion commands, overspeed could occur in blending if the velocity of both
motion commands is large. Besides, as blend function is based on the effect
of velocity vector superposition, the trajectory of blending will change and
become unpredictable after velocity is adjusted or robot is stopped then
started again.

Move PL1 Armcmd=1 ‘Specified the armcmd of current Move command

Armcmd = 2 ‘Switch global armcmd of all following motion commands

Move PL2 ‘Default command armcmd as 2 set by last command (Right hand)

Move PL1 WithPls=PT_1 ‘ Add position trigger.

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.

Besides, position trigger should be configured in Project setting before adding.

Finally, both SIGNAL1and SIGNAL2 mentioned here should be configured in


Input & Output setting. If two signals do not exist, error will report during
execution.

Move PL1 abs=0 ‘ Set input target point as relative position

Move PL2 abs=1 ‘Set input target point as absolute position

Move PL3 ‘Set default as absolute position

Move PL1 Acc=7000 ‘Set acceleration

184 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Move PL1 Dec=7000 ‘Set deceleration

Move PL1 Jerk=7000 ‘Set jerk

Example program is as follow, where target point should be created in project


by the user:

program

Attach

Armcmd=0

Move J1 -50 VScale=20

Move PL1 VScale=20 Blend=30

Move PL2 VScale=15 Blend=10 AScale=20

Move PL3 VScale=30 AScale=20 Until SIGNAL1=on

Move PL1 VScale=50 AScale=25 WithPls=PT_1

Move PL2 Blend=10 VScale=15 AScale=20

Move PL3 VScale=30 Armcmd=2

Armcmd=2

Move PL1 AScale=20 Blend=20

Armcmd=0

Move PL2 VScale=15 Blend=10 AScale=20 Acc=7000 Dec=7000


Jerk=7000

Move J3 -30 VScale=20

Move SCARA #{10,10,0,0} abs=0 VScale=20 Blend=10

Move {10,0,-20,0} VScale=30 abs=0

Detach

end program
See Also
JUMP, ABSOLUTE, ACCELERATION, DECELERATION, JERK,
STARTTYPE, WITHPLS, BLENDPERCENTAGE, BLENDMETHOD, CIRCLE,
MOTION, MOVES, POSITIONFINAL, SELECTAXES, WAITFORMOTION,
VSMODE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 185 / 415


MC-Basic Commands 2.7

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:

<Property Name> = <value>

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.

For example, Cartesian #{0, 0, 0, 0} or Joint {0,0,0,0}.


<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.
<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.
186 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7

For example, if the orientation rotation of current motion command is 90°,


when BlendOrientation=20, it indicates that when the orientation rotation is
70°, the remaining 20°orientation angle will blend with that of the next motion
command. Defined maximum value will not exceed the half of total rotation,
that is, 45°.

<Blendstartprotected>:blend start point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from start point to the specified point, the priority is
higher than BlendDistance and blendOrientention.

If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.

<Blendendprotected>:blend end point protection.

In every Moves statement, Blendstartprotected can be used to guarantee


blend will not be executed from the specified point to the end point, the priority
is higher than BlendDistance and blendOrientention. If Blendendprotected 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.

<WithPls>: position trigger

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.

<Until>:A function property to interrupt executing motion.

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.

Under absolute position mode, position commend of element is the needed


absolute position. Under relative position mode, position command is needed
position changes. Value 0 represents relative position, and value 1 represents
absolute position. If not set, default value is 1.

<VTRAN>: VELOCITYTRANS, translation velocity value of motion arc, unit


mm/sec.

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.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 187 / 415


MC-Basic Commands 2.7

<ATRAN>:ACCELERATIONTRANS, translation acceleration of the motion


arc, unit mm/sec2.

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.

<DTRAN>:DECELERATIONTRANS, translation deceleration of the motion


arc, unit mm/sec2.

When executing motion command, deceleration should smaller than or equals


to system maximum translation deceleration. If the property is larger, the
system maximum translation deceleration should be used to execute motion.

<JTRAN>:JERKTRANS, translation jerk of the robot motion. Jerk refers to


the rate of change of acceleration.

<VROT>: VELOCITYROT, rotation velocity of the motion arc, unit


degree/sec.

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.

<AROT>:ACCELERATIONROT, rotation acceleration of the motion arc, unit


degree/sec2.

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.

<DROT>: DECELERATIONROT, rotation deceleration of the motion arc, unit


degree/sec2.

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.

<JROT>:JERKROT, rotation jerk of the robot. Jerk refers to rate of change


of acceleration.

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

Moves #{370.242, -151.397, -50, -22.24} ‘Enter Cartesian coordinate position


manually

188 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Moves {20.837, 9.3, -50, 0} ‘Enter Joint point position manually

Moves PL1 BlendDistance=100 ‘Add blend property

Move PL2 Blend=35 ‘Add blend property

Move PL1 VScale=50 ‘Adjust velocity percentage

Move PL2 AScale=40 ‘Adjust acceleration percentage

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.

In addition, as Blend is achieved based on velocity vector superposition of two


motion commands, overspeed could occur in blending if of both motion
command velocity is large. Besides, because blend is based on the effect of
velocity vector superposition, the blending trajectory will change and become
unpredictable after velocity is adjusted or robot is stopped then started again.

Moves PL1 WithPls=PT_1 ‘Add position trigger

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

Moves PL1 Armcmd=1 ‘Specified the armcmd of current Move command

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.

Move PL1 Armcmd=1 ‘‘Specified the current armcmd of Moves command

Moves PL2

Besides, position trigger should be configured in Project setting before adding.

Finally, both SIGNAL1and SIGNAL2 mentioned here should be configured in


Input & Output setting. If two signals do not exist, error will report during
execution.

Moves SCARA #{60,50,0, 100} abs=0 BlendOrientation=20


BlendDistance=30’ Specify blend orientation and blend distance

Note: specify blend orientation and blend distance simultaneously will be


determined by the relative size relative to their respective half lengths.
Assuming total translation length of current trajectory is 60, BlendDistance=30,
the actual relative half-length is 30/30=100%, meanwhile the total orientation
angle is 100°, BlendOrientation=20,the ratio of relative half-length is
20/50=40%, less than 100% of translation, therefore the actual blend will start
at the start point of translation.

Moves PL1 abs=0 ‘Set input target point as relative position

Moves PL2 abs=1 ‘Set input target point as absolute position

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 189 / 415


MC-Basic Commands 2.7

Moves PL3 ‘Set default as absolute position

Moves PL1 VTRAN=1000 ‘Set translation acceleration

Moves PL1 ATRAN =5000 ‘Set translation deceleration

Moves PL1 JTRAN =5000 ‘Set translation jerk

Moves PL1 VROT=100 ‘Set rotation acceleration

Moves PL1 AROT =1000 ‘Set rotation deceleration

Moves PL1 JROT =7000 ‘Set rotation jerk

Example program is as follow, where target point should be created in project


by the user:

program

Attach

Move PL1 VScale=20 Armcmd=1

Moves PL2 VScale=15 Blend=10 AScale=20

Moves PL3 VScale=30 AScale=20 Until SIGNAL1=on

Moves PL1 VScale=50 AScale=25 WithPls=PT_1

Moves PL2 BlendDistance=10 VScale=15 AScale=20

Moves PL3 VTran=300 ATran=1000 JTran=5000

Move PL1 AScale=20 Armcmd=2

Move PL2 VRot=100 ARot=500 JRot=1000

Moves SCARA #{10,10,0,100} abs=0 VTran=300 ATran=1000 VRot=100

Moves SCARA #{-10,-10,0,-100} abs=0 BlendOrientation=20

Moves SCARA #{-10,-10,0, 100} abs=0 BlendOrientation=20

Moves SCARA #{60,50,0, 100} abs=0 BlendOrientation=20

BlendDistance=30

Move PL1 VScale=20

Moves SCARA #{-10,-10,0, 100} abs=0 BlendOrientation=20

Moves SCARA #{-10,-10,0, 100} abs=0 Blendstartprotected=20

Move PL1 VScale=20

Moves SCARA #{-50,-50,0, 100} abs=0 Blendendprotected =20

Moves SCARA #{-100,100,0, -100} abs=0 Blend=50

Moves SCARA #{100,-100,0, 100} abs=0 Blendendprotected =50

Move {10,0,-20,0} VScale=30 abs=0

Detach

end program

190 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 191 / 415


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only.

<user exception> must be defined.


Examples
?myerror.Msg'assuming myerror was defined by the user.
See Also
ERROR, NUM

192 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
N

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

<return value>: system name


Limitations
system.name cannot exceed length of 11 characters.
Examples
System.Name = “XY Table”

?System.name
See Also
INFORMATION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 193 / 415


MC-Basic Commands 2.7

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)

194 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only. <user exception> must be defined.
Examples
?myerror.num'assuming myerror was defined by the user.
See Also
ERROR. MSG

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 195 / 415


MC-Basic Commands 2.7

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

<return value>: Long, 1 to MaxLong.


Limitations
Read Only .Task must be loaded in memory
Examples
StartTask Task1.prg Priority=3 NumberOfLoops=3 ‘Run 3 times

?Task1.prg.NumberOfLoops

Prints the following: 3

Or From the Task1.prg:

program

? NumberOfLoops ‘ should return 1

end program

196 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
O

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.

Examples include position following errors. Errors not trapped by a


TRY/FINALLY mechanism within the task are trapped by ONERROR.

When an error is trapped, the specified error processing code is run 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.
NOTE
SYNCHRONOUS errors stop a task that catches them by means of "onerror"
so that a "continuetask" is needed

ASYNCHRONOUS errors do not stop a task even if caught from "onerror" so


the task is automatically continuing.
Syntax
Program 'Beginning of program

<Code>

OnError 'Start of OnError block

{catch <error number X>

<code to execute when error X occurs>}

{catch <error number Y>

<code to execute when error Y occurs>}

{catch else

<code to execute for all other errors>}

End OnError 'End of OnError block

<Code>

End Program 'End of program


Limitations
ONERROR traps only errors associated with the task in which they are
defined.

Nesting of ONERROR is not allowed.


Examples
OnError

catch 3017

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 197 / 415


MC-Basic Commands 2.7

print "Position Following Error"

System.motion = 0'Stop all motion

killtask task2.prg

End OnError
See Also
LOGGER, TRY_..._END_TRY

198 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

ScanTime is given as a number of MOTION BUS time cycles. A value of 1


causes the condition to be checked every cycle.

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=}

<command block that defines the action>

End Onevent
Parameters
<event>: Alphanumeric string, the event name

<condition>: an expression

<priority>: Long

<scan time>: Long


Limitations
An event must be enabled (using EVENTON) in order to be processed. An
event cannot kill its parent task (the task in which it is defined). Event
conditions do not consist of variables or properties that cannot be delivered at
the same cycle. SYSTEM.ALOAD cannot be in the event condition. Do not
declare events in a subroutine or user function. OnEvent cannot be defined
from IF, WHILE, or other loops.
Examples
OnEvent EV1 SysDin.1=1 'Trigger event when input 1 is 1

Move X-axis 50000

End OnEvent
See Also
EVENTLIST, EVENTOFF, EVENTON

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 199 / 415


MC-Basic Commands 2.7

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.

ONSYSTEMERROR is written in the body of a task, but only one instance


may exist in the system at any time.

It is used to trap both synchronous and asynchronous errors in all tasks, as


well as errors that occur within the context of the system.

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.

A system error is not associated with a specific task. An example of a system


error is a position following error that occurs due to some external force being
applied to an axis not attached to a task.

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.

ONSYSTEMERROR is used to trap errors not specifically trapped by TRY or


ONERROR. It is then either used to execute an orderly shutdown of the
system, or an orderly recovery procedure.
NOTE
SYNCHRONOUS errors stop a task that catches them by means of "onerror"
so that a "continuetask" is needed.

ASYNCHRONOUS errors do not stop a task even if caught from


"onsystemerror" so the task is automatically continueing.
Syntax
Program 'Beginning of program

<Code>

OnSystemError 'Start of OnSystemError block

{catch <error number X>

<code to execute when error X occurs>}

{catch <error number Y>

<code to execute when error Y occurs>}

{catch else

<code to execute for all other errors>}

End OnSystemError 'End of OnSystemError block<br>

<Code>

200 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

End Program 'End of program


Limitations
Only one instance of ONSYSTEMERROR can appear in the system
Examples
OnSystemError

catch 12055 'catch Missing MOTION BUS telegram error

Print "Missing telegram(s): communication interrupted"

End OnSystemError
See Also
ONERROR

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 201 / 415


MC-Basic Commands 2.7

OPEN_FILE
Description
Opens an existing file or creates new one (in “write” mode) with the name
given in the string expression.

Filename should not exceed8 characters and one of next extensions:

PRG , DAT , TSK , CMP for files ,open at Flash disk

Or REC, TXT , which open at RAM disk.

Open text file for read, write or append to the existing file according to mode
flag.

"r"- open text file for reading

"w" - truncate to zero length or create text file for writing

"a" - append; open or create text file for writing at end-of-file

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)

<mode flag>: String

"r" – read mode

"w" – write mode

"a" -append mode

<DeviceHandle>: Long, file handle, 1 to 255


Limitations
The defined file should exist on DiskOnChip for read and append modes
Examples
Open "File1.PRG" Mode="w" as #1

Or

Common shared FileNameStr as string = "File1.PRG"

Common shared ModeStr as string = "w"

Open FileNameStr Mode= ModeStr as #1


See Also
CLOSE, INPUT$, LOC

202 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

1: NO_DELAY. Send data immediately.

<device number>: file handle, Long


Examples
OpenSocket Options=1 as #1
See Also
CLOSE, CONNECT, ACCEPT, PING, IPADDRESSMASK

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 203 / 415


MC-Basic Commands 2.7

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

<value> : given allowed operation mode, Long, 0, 1, 2


Limitations
Write in CP4 only, Opmode change allowed in disabled state only.

OPMODE change of an axis belonging to an attached group is not allowed

Modal only
Examples
A1.OpMode = 2

i = A1.OpMode
See Also
TORQUECOMMAND, TORQUEFEEDBACK

204 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

ORITYPE
Description
The ORITYPE is used to control the orientation of the SMOVE command
during its movement.

0 -- Standard Mode: which means SMOVE can accurately reach the


orientation of each point.

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 205 / 415


MC-Basic Commands 2.7
P

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

INDEX2: INT, end index of given point array


Limitations
Write Only

Nodal only
Examples
SMOVE Array PASSINDEX=1,50
See Also
SMOVE

206 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PAYLOADINERTIA
Description
Payload inertia of mass around the axis of the last joint.

This value is considered during the computation of joint torques by the


dynamic model.
Syntax
<ROBOT>.PayloadInertia = <expression>
Domain
ROBOT
Parameters
< ROBOT >: valid ROBOT

< expression >: Double


Limitations
Read/Write

Modal only
Examples
SCARA.PayloadInertia = 0.05

? SCARA.PayloadInertia
See Also
PAYLOADLX, PAYLOADLY, PAYLOADMASS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 207 / 415


MC-Basic Commands 2.7

PAYLOADLX
Description
Payload center of mass (C.M) distance of a robot in the tool's x direction.

This value is considered during the computation of joint torques by the


dynamic model.
Syntax
< ROBOT >.PayloadLx = <expression>
Domain
ROBOT
Parameters
< ROBOT >: valid ROBOT

< expression >: Double


Limitations
Read/Write

Modal only
Examples
SCARA.PAYLOADLX = 0.0

? SCARA.PAYLOADLX
See Also
PAYLOADLY, PAYLOADINERTIA, PAYLOADMASS

208 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PAYLOADLY
Description
Payload center of mass (C.M) distance of a robot in the tool's y direction.

This value is considered during the computation of joint torques by the


dynamic model.
Syntax
< ROBOT >.PayloadLy = <expression>
Domain
ROBOT
Parameters
< ROBOT >: valid ROBOT

< expression >: Double


Limitations
Read/Write

Modal only
Examples
SCARA.PAYLOADLY = 0.0

? SCARA.PAYLOADLY
See Also
PAYLOADLX, PAYLOADINERTIA, PAYLOADMASS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 209 / 415


MC-Basic Commands 2.7

PAYLOADMASS
Description
Payload mass of an element.

This value is considered during the computation of joint torques by the


dynamic model.
Syntax
< ROBOT >.PayloadMass = <expression>
Domain
ROBOT
Parameters
< ROBOT >: valid ROBOT

< expression >: Double


Limitations
Read/Write

Modal only
Examples
SCARA.PAYLOADMASS = 3

? SCARA.PAYLOADMASS
See Also
PAYLOADLX, PAYLOADLY, PAYLOADINERTIA

210 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PAYLOADMAX
Description
The maximum allowed mass for the payload of the element.

If paylodMass property is set to a larger value, an error is thrown.


Syntax
< ROBOT >.PayloadMax = <expression>
Domain
ROBOT
Parameters
< ROBOT >: valid ROBOT

< expression >: Double


Limitations
Read/Write

Modal only
Examples
SCARA. PAYLOADMAX = 10

? SCARA. PAYLOADMAX
See Also
PAYLOADLX, PAYLOADLY, PAYLOADMASS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 211 / 415


MC-Basic Commands 2.7

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

212 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 213 / 415


MC-Basic Commands 2.7

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>:

-1 = if remote host is unreachable

0 = OK
Examples
? Ping (”212.25.84.109”)
See Also
ACCEPT, CLOSE, CONNECT, OPENSOCKET, IPADDRESSMASK

214 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PLSLIST
Description
This query returns a list of the PLS names defined in the system, The
information is displayed in the following format:

PlsName=<pls>, AxisName=<axis>, Output=<pls output>

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:

PlsName=<pls>, AxisName=<axis>, Output=<pls output>


Limitations
Read only
Examples
?Plslist

?plslist PT*
See Also
AXISLIST, GROUPLIST, TASKLIST, VARLIST, VARLIST$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 215 / 415


MC-Basic Commands 2.7

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

<digital output signal> : any signal with digital output type


Limitations
Can be set only when PLS is disabled.

The signal must exist, whose type must be digital output


Examples
PLS1.Pout = SIGNAL1

?PLS1.PlsOutput ‘returns “SIGNAL1”


See Also
PLSSOURCE

216 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

PLSPOLARITY
Description
Sets or queries the initial polarity of the system output associated with a PLS.

The initial polarity of a PLS is specified as 1 or 0. The default value is 0. The


output state is set when the PLS is enabled (PLSEnable).

The value of the output is determined by the axis position at the moment of
PLSenable according to the following scheme:

If Pcmd < PLSPosition[1] → Output = negative PLSPolarity


Short form
<pls>.Ppol
Syntax
<pls>.PlsPolarity = <polarity>

?<pls>.PlsPolarity
Domain
PLS
Parameters
< pls >: any valid pls variable

< polarity > : Long, 0 or 1


Limitations
Can be set only when PLS is disabled.
Examples
Pls1.PlsPolarity = 0
See Also
PLSSOURCE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 217 / 415


MC-Basic Commands 2.7

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

<index>: 1 to the size of PLS data structure

<PLS position>: Double, ± MaxDouble


Limitations
Can be set only when PLS is disabled.
Examples
PLS1.PlsPosition[1] = 2076.56
See Also
PLSSOURCE

218 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<value >: Long, o or 1


Examples
PLS1.RelatedTo = 1
See Also
PLSSOURCE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 219 / 415


MC-Basic Commands 2.7

PLSSOURCE
Description
Defines the type of position that toggles the PLS output.

PLSSource can be based either on an absolute position (either XYZ or axis),


or on a position relative to the current movement.

Overrides PLSSource value of the element.


Source Description Absolute/Relative
PathLength Distance on the path, in Relative to start/ target
user units position
PathPercentage Percentage of the path Relative to start/ target
position
PathTime Time duration, in Relative to start/ target
milliseconds position
Syntax
<pls>.PLSSOURCE= <source type>
Domain
PLS
Parameters
< pls >: any valid pls variable

< source type >: source type


Examples
PLS1.PLSSOURCE = scara.PATHLENGTH
See Also
PLSOUTPUT, PLSPOLARITY, PLSPOSITION, PLSRELATEDTO

220 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<return value>: Long

Examples
?PLT_GET_INDEX_STATUS ("PLT1")
See Also
PLT_SET_INDEX_STATUS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 221 / 415


MC-Basic Commands 2.7

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

<PalletName>: String, any valid pallet


Examples
PLT_MOVE_TO_ENTRY_POSITION (SCARA,"PLT1")
See Also
PLT_PICK_FROM_PALLET, PLT_PLACE_ON_PALLET,
PLT_RETRACT_FROM_ITEM

222 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<PalletName>: String, any valid pallet


Examples
PLT_PICK_FROM_PALLET(SCARA,"PLT1")
See Also
PLT_MOVE_TO_ENTRY_POSITION, PLT_PLACE_ON_PALLET,
PLT_RETRACT_FROM_ITEM

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 223 / 415


MC-Basic Commands 2.7

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

<PalletName>: String, any valid pallet


Examples
PLT_PICK_FROM_PALLET(SCARA,"PLT1")
See Also
PLT_MOVE_TO_ENTRY_POSITION, PLT_PICK_FROM_PALLET,
PLT_RETRACT_FROM_ITEM

224 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<PalletName>: String, any valid pallet


Examples
PLT_RETRACT_FROM_ITEM (SCARA,"PLT1")
See Also
PLT_MOVE_TO_ENTRY_POSITION, PLT_PICK_FROM_PALLET,
PLT_PLACE_ON_PALLET

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 225 / 415


MC-Basic Commands 2.7

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

<index>: Long, current item index to set


Examples
PLT_SET_INDEX_STATUS ("PLT1", 2)
See Also
PLT_SET_INDEX_STATUS_EMPTY, PLT_SET_INDEX_STATUS_FULL,
PLT_GET_INDEX_STATUS

226 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 227 / 415


MC-Basic Commands 2.7

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

228 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Double vector


Limitations
Read only
Examples
Axis

?A1.PCmd
Robot

?SCARA.PCmd
See Also
ACCELERATIONCOMMAND, VELOCITYCOMMAND,
POSITIONFEEDBACK, POSITIONFINAL, POSITIONTOGO,
ACCELCMDCART, POSITIONCOMMANDHISTORY, START_JOINT

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 229 / 415


MC-Basic Commands 2.7

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

[t]: the index of PositionCommandHistory


Return Value
returns the history of position command generated by the motion profiler

<return value>: Double


Limitations
Read only
Examples
Axis

?A1.PCmdH
Robot

?SCARA.PCmdh
See Also
POSITIONCOMMAND

230 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

If it exceeds the value of PEMAX, the element is brought to an immediate


stop. If the element is at rest when the error is detected, the drive is disabled.

The following error is at a minimum when the drive is properly tuned. An


additional servo delay is added when micro-interpolation is enabled on the
CDHD drive. In this case, the position error calculated by the System is
slightly larger, but the motion is smoother.

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:

SQRT((SetPoint{1}-Here{1})2 + (SetPoint{2}-Here{2})2 +(SetPoint{3}-Here{3})2)


Short form
<element>.PE
Syntax
?<element>.PositionError
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns actual distance between position parts of SetPoint and Here.

<return value>: Double


Limitations
Read only
Examples
Axis

?A1.PE
Robot

?SCARA.PE
See Also
POSITIONERRORSETTLE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 231 / 415


MC-Basic Commands 2.7

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

232 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Double vector


Limitations
Read only
Examples
Axis

?A1.pfb
Robot

?SCARA.pfb
See Also
POSITIONCOMMAND

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 233 / 415


MC-Basic Commands 2.7

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

<return value>: Double vector


Limitations
The target position is be specified within each motion command.

As an individual property, it is read-only.


Examples
Axis

?A1.Pfinal
Robot

?SCARA.Pfinal
See Also
POSITIONCOMMAND, POSITIONTOGO, CIRCLE, MOVE

234 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: Double


Limitations
Read only
Examples
?A1.PositionToGo
See Also
POSITIONCOMMAND, POSITIONFINAL

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 235 / 415


MC-Basic Commands 2.7

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

Move scara {0,0,0,0}

Waitformotion scara

Detach scara

Power_off()

End program
See Also
POWER_ON

236 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Move scara {0,0,0,0}

Waitformotion scara

Detach scara

Power_off()

End program
See Also
POWER_OFF

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 237 / 415


MC-Basic Commands 2.7

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.

The ControlStudio Watch window manages queries to the specified variables.


Use Print “” to print an empty line.

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 <Expression>{ <Expression>}

PRINT <Expression> {; <Expression>}


Parameters
< Expression>: Long, Double, String, Joint, 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
Print "Hello,";

Print "world."

Prints the following:

Hello,world.

Or

Print "Hello," "world."

238 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Prints the following:

Hello,world.

Or

Print "Hello," , “world.”

Prints the following:

Hello, world.

Or

Print "Hello,"

Print "world."

Prints the following:

Hello,

world.

Or

Print "Hello," ; "world."

Prints the following:

Hello,world.
See Also
PRINTUSING, PRINTTOBUFF, PRINTUSINGTOBUFF, PRINTPOINT,
PRINT_HASH, PRINTPOINTUSING

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 239 / 415


MC-Basic Commands 2.7

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>}

PRINT #<DeviceHandle> <Expression>{ <Expression>}

PRINT #<DeviceHandle> <Expression>{; <Expression>}


Parameters
<DeviceHandle>: file handle, Long, 1 to 255

< Expression >: Long, Double, String, Joint or Location


Limitations
Read only
Examples
Print #1, Nm$, Dept$, Level, Age
See Also
PRINT, PRINTUSING, CLOSE, INPUT$, LOC

240 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Prints the following: #{0 , 0 , 0 , 0;}

common shared PNT as Joint of XYZR

PNT = {0,0,0,0}

PrintPoint PNT

Prints the following: {0 , 0 , 0 , 0}


See Also
PRINTPOINTUSING, PRINT, PRINTUSING

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 241 / 415


MC-Basic Commands 2.7

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.

The following characters can be used formatting numeric expressions:

# digital position

.decimal position

+ prints the sign of the expression

^^^^ prints in exponential format


Short form
PrintPointU
Syntax
PrintPointUsing <format_string>;[<expression>];{[<expression>]}*
Parameters
<format_string>: String

<expression>: Point(Joint or Location)


Limitations
Only a single formatting text(containing text and formatting characters)
followed by the expressions to print is allowed.
Examples
common shared PNT as Location of XYZR

PNT = #{0,0,0,0}

PrintPointUsing "#.###"; PNT

Prints the following: #{0.000 , 0.000 , 0.000 , 0.000;}


See Also
PRINT, PRINTPOINT, CLOSE, INPUT$, LOC

242 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

If send assignment is abolished, send defaults to False.


Syntax
PRINTTOBUFF #<DeviceHandle>, [Expression] {, ;[Expression]} {SEND =
TRUE or FALSE}
Parameters
<DeviceHandle>: file handle, Long, 1 to 255

< Expression >: Long, Double, String, Joint or Location


Limitations
Read only
Examples
PrintToBuff #1, Nm$, Dept$, Level, Age

PrintToBuff #1, Nm$, Dept$, Level, Age Send = True


See Also
PRINT, CLOSE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 243 / 415


MC-Basic Commands 2.7

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.

The following characters can be used formatting numeric expressions:

# digital position

.decimal position

+ prints the sign of the expression

^^^^ prints in exponential format

Only a single formatting string (containing text and formatting characters)


followed by the expressions to print is allowed.
Short form
PrintU
Syntax
PrintUsing <format_string>;[<expression>];{[<expression>]}*
Parameters
<format_string>: output format, String

<expression>: Long, Double or String


Limitations
Only 15 digits after the decimal point can be displayed. The statement,

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

PrintU "B is ##.##";B

‘prints B IS 33.34

PrintU "B is ##.####";B


244 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7

‘prints B IS 33.3440

PrintU "B is ##.##^^^^";B

‘prints B IS 3.33e+01

(you must use exactly four ^s for this format to work)

Another example:

PrintU "The number is # ";j1,j2

Prints “The number is 1 The number is 2 ”

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:

PrintU "Keep numbers to a fixed length with PrintUsing: ######"; 100

Prints “Keep numbers to a fixed length with PrintUsing: 100"


See Also
CLOSE, INPUT$, LOC, PRINT, PRINT_HASH, PRINTPOINT,
PRINTUSING$, PRINTUSING_HASH-SIGN, PRINTUSINGTOBUFF

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 245 / 415


MC-Basic Commands 2.7

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>]}*

PrintUsing$<structure_name>-><string_name>{[ ]}, <format_string>;


[<expression>];{[<expression>]}*
Parameters
< string_name >: String . The string may be a structure field also .

<format_string>: String

<expression>: Long or Double


Limitations
Only 15 digits after the decimal point can be displayed. The statement:

printu “#.################”;My_Var
Examples
Specify a minimum number of characters to print by using the “#” sign and
decimal point.

Common shared StSCARA as string

Common Shared B as Double

B = 33.344

PrintU$ StSCARA , “B is ##.##”;B

?StSCARA

‘Prints “B is 33.34”
See Also
CLOSE, INPUT$, LOC, PRINTUSING

246 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<expression>: Long or Double


Limitations
Only 15 digits after the decimal point can be displayed. The statement,

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

PrintU #1 “B is ##.####”;B ‘prints B IS 33.3440

PrintU #1 “B is ##.##^^^^”;B ‘prints B IS 3.33e+01


See Also
CLOSE, LOC, INPUT$, PRINTUSING

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 247 / 415


MC-Basic Commands 2.7

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.

Only a single formatting string (containing text and formatting characters)


followed by the expressions to print is allowed.

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).

If send assignment is abolished, send defaults to False.


Short form
PrintUToBuff #
Syntax
PrintUsing #< DeviceHandle>, <format_string>;
[<expression>];{[<expression>]}* {Send = True | False}
Parameters
<DeviceHandle>: file handle, Long, 1 to 255

< Expression >: Long, Double, String, Joint or Location

<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

248 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<proceed type>: Long, 1, 2, 3


Limitations
If <proceed type> is not specified, the permanent value of the <proceed type>
is used, as specified by the PROCEEDTYPE property.
Examples
Proceed SCARA ProceedType = NextMotion
See Also
PROCEEDTYPE, STOP

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 249 / 415


MC-Basic Commands 2.7

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).

2 (NEXTMOTION) – Abort current motion and execute the next motion


command in the motion buffer. One that was executing during STOP is forgotten
and the one that was pending is executed).

3 (CLEARMOTION) – Abort all motion commands in the motion buffer. Actually


clears the motion buffers from complete history

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

< expression > : the proceed mode, Long, 1 to 5


Examples
Axis

A1.ProceedType = Continue

?A1.ProceedType

Proceed A1 ProceedType=Next
Robot

SCARA.ProceedType = Continue

?SCARA.ProceedType

Proceed SCARA ProceedType=Next


See Also
PROCEED

250 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

By adding the Continue keyword to the Program keyword, the program


automatically starts executing after it is loaded.

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 251 / 415


MC-Basic Commands 2.7

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

252 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
R

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.

The actual recording process is triggered by RECORDON.

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

<number of points>: Long, numbers of Sample Point

<ring buffer>: 1/0

1 = ON

0 = OFF

<record gap>: Long, Sample Period, unit is millisecond, 1 to 64, specifies the
number of EtherCAT cycles between samples

<expression>: Long, Double


Limitations
The record file is stored on the RAM drive, so size is limited. Recording stops
if there is no space available on the RAM drive. A RECORDCLOSE command
must be issued before a second RECORD command is issued.

Local variables can not be recorded .


Examples
Record Motion.rec 1000 Gap = 1RecData = a1.pcmd, a1.pfb, a2.pcmd, MyVar

RecordOn

RecordOff

RecordClose
See Also
RECORD$, RECORDCLOSE, RECORDING, RECORDOFF, RECORDON

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 253 / 415


MC-Basic Commands 2.7

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.

The actual recording process is triggered by RECORDON.


Syntax
RECORD$ <record file name> <number of points> {Gap = <record gap>}
{RingBuffer = <ON|OFF>}RecData = <expression>{, <expression>}
Parameters
<record file name>: String, including file name and extension.

<number of points>: Long, numbers of Sample Point

<ring buffer>: 1/0

1 = ON

0 = OFF

<record gap>: Long, Sample Period, unit is millisecond, 1 to 64 ,specifies the


number of EtherCAT cycles between samples

<expression>: Long, Double


Limitations
The record file is stored on the RAM drive, so size is limited. Recording stops
if there is no space available on the RAM drive. A RECORDCLOSE command
must be issued before a second RECORD command is issued.

Local variables cannot be recorded.


Examples
Record$ “Motion.rec” 1000 Gap = 1RecData = a1.pcmd, a1.pfb, a2.pcmd,
MyVar

Dim shared RecFileString as string = “Motion.rec”

Record$ RecFileString 1000 Gap = 1 RecData =a1.pcmd, a1.pfb, a2.pcmd,


MyVar

RecordOn

RecordClose

Record$ RecFileString 1000 RingBuffer=On RecData = a1.pcmd, a1.pfb,


a2.pcmd, MyVar

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 255 / 415


MC-Basic Commands 2.7

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$

256 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

RECORDING
Description
This query returns the state of the data recorder. The following values are
returned:

0 - recorder undefined and inactive.

1 - Recorder is defined, but inactive. (The RECORDON command is needed to


activate it.)

2 - Recording is in progress (Data acquisition process after RECORDON was


given.)

3 - Recording suspended. (RECORDOFF command issued.)

4 - Data acquisition completed automatically. Recorder is still defined.


(RECORDCLOSE command needed to flush the data to the disk.)
Syntax
?Recording
Return Value
returns the state of the data recorder

<return value>: Long, 0 to 4


Limitations
Read only
Examples
?Recording
See Also
RECORD, RECORDCLOSE, RECORDOFF, RECORDON, RECORD$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 257 / 415


MC-Basic Commands 2.7

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$

258 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 259 / 415


MC-Basic Commands 2.7

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.

The command can be used together with the STOPPATH.


NOTE
RECOVERPATH can only be used after STOPPATH is completed.

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,

260 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

' This is also a comment line

Move a1 156.7rem Move axis a1 to position 156.7

Move a2 0 ' Comment with an apostrophe


See Also
PROGRAM_..._END_PROGRAM

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 261 / 415


MC-Basic Commands 2.7

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

262 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

RIGHT$
Description
RIGHT$ returns the specified number of characters from the right-hand side of
the string.
Syntax
RIGHT$(<string>,<expression>)
Parameters
<string>: String

<expression>: Long, 0 to Max length of <string>


Return Value
returns the specified number of characters from the right-hand side of the
string

<return value>: String


Limitations
Read only
Examples
Test=”This string is too short”

PRINT RIGHT$(Test,4)

Prints the following: hort


See Also
LEFT$, MID$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 263 / 415


MC-Basic Commands 2.7

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:

2.5 -> 3.0

1.5 -> 2.0

1.49 -> 1.0


Syntax
Round(<expression>)
Parameters
<expression>: Double, ± MaxDouble
Return Value
<return value>: Double
Limitations
Read only
Examples
?Round(4.5)

Prints the following: 5

VaSCARA = Round(Var2)
See Also
INT

264 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
PRINT RTRIM$(“a left-justified string ”);”next”

Prints the following: a left-justified stringnext


See Also
LTRIM$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 265 / 415


MC-Basic Commands 2.7
S

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.

If <SelectExpression> matches a condition associated with one of the CASE


clauses, the statements following that CASE clause are executed up to the
next CASE clause, or up to END SELECT for the last one. Control then
passes to the statement following the END SELECT.

The flow control structure is preferred to IF…THEN when there are many
execution paths based on the value.

The <SelectExpression> is compared against as many exact values as


necessary, using the CASE <expression> syntax.

The <SelectExpression> is logically compared against another expression


using the CASE IS <relational-operator> <expression> syntax. Any of the six
relational operators may be used (>, >=, <, <=, =, <>).

The <SelectExpression> may be compared against a range of values using


the CASE <expression> TO <expression> syntax.

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} }

{CASE IS <relational-operator> <expression>

{statement_list} }

{CASE <expression> TO <expression>

{statement_list} }

{CASE <expression> comma <expression>

{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

<expression>: variable or const Double, Long, String

<relational-operator>: >, >=, <, <=, =, <>.


Examples
Dim I as Long

Select Case I

Case 0

Print "I = 0"

Case is >= 10

Print "I >= 10"

Case is < 0 'No requirement for statements after Case<0

Case 5 To 10

Print "I is between 5 and 10"

Case 2, 3, 5 'Added in Version 4.7.1

Print "I is 2, 3 or 5"

Case Else

Print "Any other I value"

End Select
See Also
IF_..._THEN_..._ELSE, PROGRAM_..._END_PROGRAM

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 267 / 415


MC-Basic Commands 2.7

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:

moving only first axis - 0001 bin (1 dec)

moving only second axis - 0010 bin ( 2 dec )

moving only third axis – 0100 bin ( 4 dec )

moving only fourth axis – 1000 bin ( 8 dec )

moving all four axes – 1111 bin (15 dec)


Short form
<ROBOT>.SAxes
Syntax
<ROBOT>.SelectAxes = <value>
Domain
ROBOT
Parameters
<ROBOT>: any valid Robot

<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

268 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 269 / 415


MC-Basic Commands 2.7

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

270 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 271 / 415


MC-Basic Commands 2.7

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

272 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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]

< LimitJ2>: double, range[1-100]

< LimitJ3>: double, range[1-100]

< LimitJ4>: double, range[1-100]


Examples
SetDriveTorqueLimit (50,50,50,100)
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
DRIVETORQUELIMIT, PEAKTORQUE, PEAKVELERR,
VELERRTHRESHOLD, SETDRIVETORQUELIMIT

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 273 / 415


MC-Basic Commands 2.7

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

< location >: location, type is xyzr


Examples
SetTool (“ToolName”,Point)
See Also
USERFRAME, SELECTBASE, SELECTTOOL, SETWORKSPACE,
SETUSERFRAME

274 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< location >: location, type is xyzr


Examples
SetUserFrame (“UserName”,Point)
See Also
USERFRAME, SELECTBASE, SELECTTOOL, SETWORKSPACE,
SETTOOL

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 275 / 415


MC-Basic Commands 2.7

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.

If a task takes the semaphore using SEMTAKE, the semaphore may be


released by the same task or by any task in the system (even from the
command line).
Short form
semgive
Syntax
semgive(<semaphore name>)
Parameters
< semaphore name >: variable semaphore
Examples
Common shared globalVariable as long

In task1:

semTake(SEM1)

globalVariable = globalVariable + 1

sleep(1000)

semGive(SEM1) ‘release the semaphore

In task2:

Sleep(100)

While semTake(SEM1,1000) = 0 ‘wait for the release of the semaphore

Sleep(10)

End While

globalVariable = globalVariable + 1

semGive(SEM1) ‘release the semaphore

When task1 execute semGive(SEM1), task2 begins to operate globalVariable


See Also
COMMON_SHARED_..._AS_SEMAPHORE, SEMAPHORESTATE

276 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

SEMAPHORESTATE
Description
SEMSTATE returns the semaphore status: 1 , if the semaphore is taken
before (busy) or 0 , if the semaphore is released .

Works for Global user-semaphores , Structure-element semaphores , the


semaphores passed by-reference (within a function \ sub block).
Short form
semstate
Syntax
?semstate(<semaphore name>)
Parameters
< semaphore name >: variable semaphore
Return Value
returns the semaphore status: 1 , if the semaphore is taken before (busy) or
0 , if the semaphore is released

<return value>: Long , 0 or 1


Limitations
A semaphore passed by-reference (within a function \ sub block).
Examples
common shared sem1 as semaphore

?SemState(sem1)

Prints the following: 0

?SemTake(sem1)

?semstate(sem1)

Prints the following: 1

SemGive(sem1)

?SemState(sem1)

Prints the following: 0


See Also
SEMAPHORETAKE, SEMAPHOREGIVE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 277 / 415


MC-Basic Commands 2.7

SEMAPHORETAKE
Description
SEMTAKE acquires a semaphore that can be used for multi-task
synchronization.

If a semaphore is free, SEMTAKE returns 1 and the semaphore is marked as


‘taken’.

If the semaphore is already taken, SEMTAKE returns 0 and the semaphore’s


status does not change.

SEMTAKE can be used to block simultaneous access to shared resources in


the system or to a critical user software section.

If time-out is provided system will try to acquire a semaphore specified amount


of time.

Semtake can return before specified timeout without acquiring a semaphore,


therefore it is essential to check return value.
Short form
semTake
Syntax
<lval> = SemTake(<semaphore name> { , <timeout>})
Parameters
< semaphore name >: variable semaphore

<timeout>: 0 to 5000
Return Value
returns 1 and the semaphore is marked as ‘taken’

< lval >: Long

0 = unsuccessful (semaphore not taken)

1 = successful (semaphore taken)


Examples
While semTake(SEM1,1000) = 0 ‘wait for the release of the semaphore

’wait for resource

Sleep(10)

End While

Or

semTake(SEM1) ‘take the semaphore

semTake(SEM1 , 100 )
See Also
COMMON_SHARED_..._AS_SEMAPHORE, SEMAPHORESTATE

278 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

SETIO
Description
Set value for signal.
Syntax
<signal_name > = <value >
Domain
IO
Parameters
<signal_name>: name of signal

<value >: double value


Limitations
Value should not be negative
Examples
Signal1 = 1 (signal1 is digital)

Signal2 = 2.3 (signal2 is analog)


See Also
GETIO , PULSE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 279 / 415


MC-Basic Commands 2.7

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

<axis_name>: any valid axis


Return Value
Returns the commanded robot Cartesian coordinates

<point_variable>: double or Location


Limitations
Modal , Read only
Examples
P1= Scara.SetPoint

? Scara.SetPoint
See Also
START

280 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<Arm>: long value; 0/1/2


Examples
SetArm(point,1)
See Also
SETPOINT

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 281 / 415


MC-Basic Commands 2.7

SETWORKSPACE
Description
This command sets the specify workspace enable or disable.
Syntax
SetWorkSpace (<WorkSpaceFrame>, <BoolValue>)
Parameters
< WorkSpaceFrame >: String, any valid Work Space Frame

<BoolValue>: Long, ON or OFF


Examples
SetWorkSpace (“WS1”, ON)
See Also
SELECTTOOL, SELECTUSERFRAME, SELECTBASE

282 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

SGN
Description
This function returns the sign of the expression.

If <expression> is positive, SGN returns +1

If <expression> is zero, SGN returns 0.

If <expression> is negative, SGN returns -1


Syntax
SGN(<expression>)
Parameters
<expression>:Double, ± Max Double
Return Value
returns the sign of the expression

<return value>: Long, -1, 0, 1


Limitations
Read only
Examples
?SGN(VaSCARA)

I = SGN(Var2)

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 283 / 415


MC-Basic Commands 2.7

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

Prints the following: 128


See Also
SHR

284 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Prints the following: 2


See Also
SHL

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 285 / 415


MC-Basic Commands 2.7

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

286 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 287 / 415


MC-Basic Commands 2.7

SIZE
Description
This function returns the number of bytes taken up by the input string.

In ASCII-8 strings SIZE()’s value is equal to LEN()’s value, whereas in UTF-8


string SIZE()’s value might be remarkably bigger than LEN()’s value.
Syntax
Size(<string>)
Parameters
<string>: String
Return Value
returns the number of bytes taken up by the input string

<return value>: Long


Limitations
Read only
Examples
?SIZE (CHR$(0xC4)) ‘ The letter Ä

Prints the following: 1

?SIZE (UTF$(0xC4))

Prints the following: 2


See Also
LEN

288 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

Sleep can be terminated by ContinueTask.


Note
When using SLEEP between two blended motions will affect the blending
result. If the SLEEP time is longer than the time of the previous motion, the
blending will not work.
Syntax
Sleep <time>
Parameters
<time>: Long, 1 to MaxLong, unit is millisecond
Limitations
Write only
Examples
Sleep 100‘Delay task for 100 msec
See Also
WAITFORMOTION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 289 / 415


MC-Basic Commands 2.7

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 point array can be a LOCATION or JOINT point array.

The parameters of the motion are: vtran, atran, dtran, vrot, arot, drot.

The syntax for the properties is: <Property Name> = <value>

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:

Large jumps in position.

Large changes in orientation between two points

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.

If inappropriate velocity is set, some related errors, such as excessive torque


will occur. Please reduce the given velocity and acceleration of the SMOVE
motion.
Syntax
SMove<ROBOT> <Array> {PASSINDEX=INDEX1, INDEX2}{ORITYPE}
{Optional Property}*
Parameters
<ROBOT>: any valid Robot

<Array>: point array given in Joint or Location

<PASSINDEX=INDEX1, INDEX2>: an optional attribute used to set which


points in the array will be executed in the SMOVE motion. INDEX1 is the
starting index of the array and INDEX2 is the ending index of the array. Points
between INDEX1 and INDEX2 will be passed to the SMOVE motion. If
PASSINDEX is not specified, the entire array will be passed to the SMOVE
motion.

<ORITYPE>: an optional attribute used to set the change in direction in the


SMOVE motion. If the value is not specified, the default value is set to

290 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

standard.

<Optional Property>*: an optional attribute used to set how the movement


speed and acceleration are limited by their respective maximum values (set by
user).group move.
Limitations
Only applicable to robots.

The length of the array storing points set from 3 to 256.

The points should be evenly distributed.

Write only. In a task, the robot must be attached to that task.


Examples
Attach SCARA

Smove array1 passindex = 1, 50 oritype = 0 vtran = 100

Smove array2 vtran = 100


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, XMAX, XMIN, YMAX,
YMIN, ZMAX, ZMIN, VSMODE, PASSINDEX, ORITYPE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 291 / 415


MC-Basic Commands 2.7

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

Prints the following: First Next


See Also
CHR$, STRING$, ASC

292 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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)

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 293 / 415


MC-Basic Commands 2.7

START
Description
Retrieves the current initial point of the movement in Cartesian coordinates.

If the group finished its movement, it is equal to SETPOINT.

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

? < element >.start


Domain
ELEMENT
Parameters
< element >: any valid motion element
Return Value
Returns the current initial point of the movement in Cartesian coordinates

<point_variable>: double or Location


Limitations
Modal Only, Read only
Examples
P1= Scara.Start

? Scara.Start
See Also
SETPOINT

294 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

START_JOINT
Description
Retrieves the current initial point of the movement in joint coordinates.

If the group finished its movement, it is equal to PCMD.

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

? < element >.start_joint


Domain
ELEMENT
Parameters
< element >: any valid motion element
Return Value
Returns the current initial point of the movement in joint coordinates

<point_variable>: double or Joint


Limitations
Modal Only, Read only
Examples
P1= Scara.Start_Joint

? Scara.Start_Joint
See Also
POSITIONCOMMAND

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 295 / 415


MC-Basic Commands 2.7

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.

This property is used inside a motion command to override the permanent


value.

1 - IMMEDIATE: the motion command is executed immediately from the system


current position does not wait for the current motion command to complete. The
current move is cancelled and any buffered move is delayed until the
IMMEDIATE command is executed.

2 - INPOSITION: the motion command is executed when the ISSETTLED flag is


set. This means the system accomplished its previous motion and reached the
required position.

3 - GENERATORCOMPLETED: the motion command executes when the


profiler has completed the generation of the last motion command reference.

4 - SYNC: the start of the motion is synchronized by the SYNCSTART


command.

5 - SUPERIMMEDIATE: similar to IMMEDIATE, but the computation of the


command is done in real-time rather than in the background.

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

< expression > : the start mode, Long, 1 to 5


Limitations
This property cannot be used within a motion command. To set the value
within a task, the element must be attached to that task (using the ATTACH
command).
Examples
Axis

296 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

A1.Strattype - InPosition

Move A1 100 StratType = Immed


Robot

SCARA.StartType = InPosition

Move SCARA {100, 20,0,0} StartType = 1


See Also
ATTACH, ISMOVING, ISSETTLED, POSITIONERRORSETTLE, JUMP,
JUMP3, JUMP3CP, MOVE, MOVES, WAITFORMOTION

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 297 / 415


MC-Basic Commands 2.7

STATE
Description
This query returns a Long value, indicating the state of the event task.

1: Running (TASK_RUNNING)

2: Stopped due to IDLETASK or after a STEPIN instruction (TASK_STOPPED)

4. Stopped due to runtime error (TASK_ERROR)


Syntax
?<event>.State
Domain
EVENT
Parameters
< event >: event name
Return Value
returns a Long value, indicating the state of the event task

<Return value>: Long, 1, 2, 4


Limitations
Event must be loaded in memory(after the execution of the OnEvent
statement and while calling task is running).
Examples
?Event1.State

If Event1.State = TASK_ERROR Then

‘Check if event is stopped due to run-time error


See Also
STATUS

298 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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>

where <state> is one of the following:

1: Running

2: Stopped (due to IDLETASK)

4: Stopped due to run-time error


Syntax
?<event>.Status
Domain
EVENT
Parameters
< event >: event name
Return Value
returns the status of an event that is loaded in memory

<Return value>: String


Limitations
Event must be loaded in memory(after the execution of the OnEvent
statement and while calling task is running).
Examples
? Event1.Status
See Also
STATE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 299 / 415


MC-Basic Commands 2.7

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.

This command can be used together with the CONTINUEPATH.


NOTE
A specific robot and axis need to be bound before using STOPPATH.

STOPPATH can be used again in the following use cases:

• CONTINUEPATH has been executed.

• The bound group/axis has been unbound.

• The bound task thread has been killed.

The stop type of this command is ONPATH by default.

Motion commands may be blocked by PAUSE button in the running


application. However, the STOPPATH command can interrupt this blockage,
and the blocked motion command will be executed directly. This usually
occurs in events.
Short form
Stoppath
Syntax
Stoppath < robot | axis>
Parameters
< robot | axis>: any valid robot or axis
Limitations
Write only.
Examples
Stoppath SCARA

300 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

Depending on the value of <group/axis>. STOPTYPE different actions will be


taken:

StopType=1 (Immediate) the current motion's velocity is reduced to zero


according to the given maximum deceleration (<axis>. DecMax or in case of
group <axis>.DecMax for each of the belonging axis), in case of group-motion
the stopping path DOES NOT HAVE TO be on the movement's trajectory.

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.

StopType=2 (OnPath) the current motion's velocity is reduced to zero according


to the given maximum deceleration (DecMax), in case of group-motion the
stopping path WILL BE on the movement's trajectory.

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.

StopType=3 (EndMotion) the current motion will be completed as it was


commanded without any interference.

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.

StopType=4 (Abort) the current motion's velocity is reduced to zero according


to the given maximum deceleration, in case of group-motion the stopping path
DOES NOT HAVE TO be on the movement's trajectory.

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.

StopType=5 (DecStopOnPath) the current motion's velocity is reduced to zero


according to the current movement's deceleration value
(DecStop/DecTran/DecRot), in case of group-motion the stopping path WILL BE
on the movement's trajectory.

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.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 301 / 415


MC-Basic Commands 2.7

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 type>: Long, 1 to 5


Limitations
Write only
Examples
Stop SCARA

Stop A1 StopType=EndMotion
See Also
PROCEED

302 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: String


Limitations
Read only
Examples
I1=12345

PRINT STR$(i1)+"A"

Prints the following: 12345A


See Also
STRD$, STRL$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 303 / 415


MC-Basic Commands 2.7

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

<format_string>: String, a valid sprintf() floating point format

%f - a non-exponential display

%e, %E - an exponential display

%g, %G - type of display depends on the value of the input


Return Value
returns the string representation of a double-type number

<return value>: String


Limitations
Read only
Examples
PRINT STRD$(45.5, "%f")

Prints the following: 45.500000

PRINT STRD$(45.5,"%e")

Prints the following: 4.550000e+01

PRINT STRD$(45.5,"%g")

Prints the following: 45.5


See Also
VAL, STR$, STRL$

304 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<ascii code>: Long


Return Value
Return a new string with the specified number of characters.

<return value>: String


Limitations
Read only. Input string cannot be a UTF-8 string.
Examples
? STRING$(23, “*”) ‘generates a string of 23 asterisks

? STRING$(23, “*5”) ‘generates a string of 23 asterisks

? STRING$(9, 65) ‘generates a string of 9 A


See Also
CHR$, SPACE$, UTFSTRING$, ASC

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 305 / 415


MC-Basic Commands 2.7

STRL$
Description
STRL$ returns the string representation of long-type number.
NOTE
A double-type input is implicitly converted to long

If an invalid format string is used, the behavior is undefined


Syntax
STRL$(<number>, <format_string>)
Parameters
<number>: Long, Double

<format_string>: String, a valid sprintf() integer format

%d, %i - signed decimal

%u - unsigned decimal

%o - octal

%x, %X - hexadecimal

%c - unsigned char
Return Value
returns the string representation of long-type number

<return value>: String


Limitations
Read only
Examples
PRINT STRL$(60, "%d")

Prints the following: 60

PRINT STRL$(60,"%o")

Prints the following: 74

PRINT STRL$(60,"%x")

Prints the following: 3c

PRINT STRL$(60,"%c")

Prints the following: <


See Also
VAL, STR$, STRD$, HEX$, CHR$

306 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

SPLITSTR$
Description
Split a string using a specific delimiter.
Syntax
SplitStr(<string>, <split>,sOutput[*])
Parameters
< string >: string, the string that needs to be split.

< split >: string, split string.

< sOutput[*] >: result, the array of strings after splitting.


Return Value
Return the number of strings after splitting.
Examples

Dim sOutput[4] as string

?SplitStr(“100,200,300”,”,”,sOutput)

Return 3

?sOutput[1] = “100”

?sOutput[2] = “200”

?sOutput[3] = “300”

Dim sOutput[2] as string

?SplitStr(“100,200,300”,”,”,sOutput)

Return 2

?sOutput[1] = “100”

?sOutput[2] = “200,300”

Dim sOutput[3] as string

?SplitStr(“100,200,300”,”:”,sOutput)

Return 1

?sOutput[1] = “100,200,300”

See Also
MID$, RIGHT$, LEFT$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 307 / 415


MC-Basic Commands 2.7

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>

<field_name>{[<index>]…} as <type> {of <type>}

END TYPE
Parameters
<structure_type_name>: type name

<field_name>: type member name

<index>: array size

<type>: the type of type member


Limitations
Array structure elements cannot have more than 10 dimensions.

Semaphore structure elements can only be scalars.

User errors and notes structure elements can only be scalars.

Changes in type definition are not allowed during reloading of the library.
Examples
Type ST

LngElem as long 'Long scalar element

LngArr[10] as long 'Long array element

DblElem as double 'Double scalar element

DblArr[2][3] as double 'Double array element

StrElem as string 'String scalar element

StrArr[4][2][5] as string 'String array element

JntElem as joint of XYZ 'Joint scalar element

308 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

JntArr[7][10][3] as joint of XYZ 'Joint array element

LocElem as location of XYZR 'Location scalar element

LocArr [6] as location of XYZR 'Location array element

A1 as generic axis 'Generic axis scalar element

AxarSCARA[4] as generic axis 'Generic axis array element

GSCARA as generic group 'Generic group scalar element

GrarSCARA[3][5] as generic group 'Generic group array element

Sem1 as semaphore 'Semaphore element

ErSCARA as error 'User error element

Nt1 as note 'User note element

End Type

'usage

dim st1 as ST

st1->DblElem = 0.1

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 309 / 415


MC-Basic Commands 2.7

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>})

{local variable declaration }

{subroutine code}

END SUB
Parameters
{Public}: Optional keyword that specifies the scope of subroutines.

<name>: sub name, except some specific symbols

{ByVal}: transfer parameter as value

<p_1>: function parameter

<type_1>: parameter type

<p_n>: function parameter

<type_n>: parameter type

{local variable declaration}: subroutine body

{subroutine code}: subroutine body


Limitations
Arrays are passed only by reference.
Examples
Public Sub Sub1(lastLoop as Long) 'Pass parameters by reference

Dim Index as long

For Index = 1 to lastloop

move a1 1 abs = 0

Next Index

End Sub
See Also
CALL, FUNCTION_..._END_FUNCTION, PROGRAM_..._END_PROGRAM

310 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

SYSTEM.ERROR
Description
Query the last system error message. This command returns an error
message which includes the error number.

The SYSTEM.ERRORNUMBER query returns only the number of the error.


Syntax
?Sys.Error

?System.Error
Domain
SYSTEM
Return Value
returns an error message which includes the error number
Limitations
Read only

system.error contains last error that is not handled by Try-catch block.


Examples
?System.Error
See Also
ERRORNUMBER

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 311 / 415


MC-Basic Commands 2.7

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.

If MOTION switches to 0 (OFF), any motion currently in progress is stopped


and decelerates to zero velocity at the maximum deceleration value, and any
motion in the motion buffers is flushed.

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

312 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
T

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 313 / 415


MC-Basic Commands 2.7

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.

<return value>: String


Limitations
Read only
Examples
?TaskError("task1.prg")

Or

Common Shared StSCARA asString

StSCARA = “Task1.Prg”

?TaskError( StSCARA)
See Also
ERROR

314 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

<return value>: Long


Limitations
Read only
Examples
?TaskErrorNumber("task1.prg")

Or

Common Shared StSCARA asString

StSCARA = “Task1.Prg”

?TaskErrorNumber( StSCARA)
See Also
TASKERROR

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 315 / 415


MC-Basic Commands 2.7

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

<return value>: Long


Limitations
Read Only .Task must be loaded in memory
Examples
?Task1.prg.TaskID hex

0x7B6CEE0

Or from the Task1.prg:

program

? TaskID hex

‘ should return 0x7B6CEE0

end program

316 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

TASKLIST
Description
Lists the names and states of loaded tasks. Each has the following format:

TaskName=<task>,State=<state>, Priority=<priority> {,FileName=<file>}

Task state:

1:Running

2:Stopped

3:Single step mode

4:Error

5:Terminated

6:Step-over mode

7:Ready ( SUSPEND STATE )

8:Task in `proceed` state (this state is invalid)

9: Incorrect state (probably kill task failed)

10: Killed ( SUSPEND STATE )

Also task may be "+Locked" in addition to the above states .The task priority
ranges from 1 through 16. The highest priority is 1.

If no tasks are loaded, the response is, “No tasks found”.

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.

<return value>: String, format:

TaskName=<task>,State=<state>, Priority=<priority> {,FileName=<file>}


Limitations
Read only
Examples
?TaskList

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$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 317 / 415


MC-Basic Commands 2.7

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:

1) when the task is Locked

2) when the task is Interrupted

A task may be Locked in states 2, 4, and 10 if it is waiting for a system event


to complete execution.

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)

2: Stopped due to IDLETASK or after a STEPIN instruction (TASK_STOPPED)

4: Stopped due to runtime error (TASK_ERROR)

5: Terminated

It can be seen momentary that state at: 1. Terminate program 2. Unload

7: Ready after LOAD (TASK_READY)

9:Task Kill Start . It's a first state of task termination procedure, after successful

termination state is internally changed to TASK_KILLED(10). In certain


circumstances due to incomplete or delayed IO operation task can remain in this
state and will require additional kill command.

10: Killed after KILLTASK OR END PROGRAM (TASK_KILLED)

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

<return value>: Long, 1, 2, 4, 5, 7, 9, 10


Limitations

318 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

Task must be loaded in memory


Examples
?TaskState(“Task1.prg”)

Or

Common Shared StSCARA as String

StSCARA = “Task1.prg”

?TaskState(StSCARA)
See Also
TASKSTATUS, ELEMENTSTATUS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 319 / 415


MC-Basic Commands 2.7

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>

where <state> is one of the following:

1: Running

2: Stopped (due to IDLETASK)

4: Stopped due to run-time error

5: Terminated.

It can be seen momentary that state at:

1. Terminate program

2. Unload

7: Ready (after LOAD)

9:Task Kill Start .

10: Killed (after KILLTASK or END PROGRAM)


Syntax
?TaskStatus("<Task Name>")
Parameters
<task name> : String
Return Value
returns the status of a task that is loaded in memory

<return value>: String, format:

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

320 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 321 / 415


MC-Basic Commands 2.7

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

322 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 323 / 415


MC-Basic Commands 2.7

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

<Return value> : string


Examples
Common shared UTF8Str as string of UTF8

? TOASCII8$(UTF8Str)
See Also
TYPEOF

324 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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).

<joint> = joint coordinates of the point to be translated into Cartesian


coordinates. The type of the joint variable must be compatible with the robot
type.
Syntax
<location_variable>=ToCart (<Robot>, <joint>)
Parameters
< Robot >: name of the Robot

<joint>: Joint, joint coordinates of the point to be translated into Cartesian


coordinates
Return Value
<Return value> : a location point in Cartesian coordinates
Limitations
The location variable and the joint parameter must have a group type identical
to the group parameter or have the same number of coordinates.
Examples
? ToCart (SCARA, {1,2,3})

? ToCart (SCARA, SCARA.Pfb)

L1 = ToCart (SCARA, J1)


See Also
TOJOINT

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 325 / 415


MC-Basic Commands 2.7

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>

location coordinates of the point to be translated into joint coordinates.

<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).

for SCARA robot

Arm (Bit 0)

value = 0 – Lefty (armcd = 1)

value = 1 – Righty (armcmd = 2)


NOTE
Constants lefty, righty, above, below, flip and noflip are defined as built-in
constants of the MC-Basic language.
Syntax
<joint_variable>=ToJoint (<Robot>, <location>, <configuration>)
Parameters
< Robot >: name of the Robot

<location>: Location, Cartesian coordinates of the point to be translated into


joint coordinates

< configuration >: Long, 0 or 1, integer describing the configuration of the


returned joint position.
Return Value
<Return value> : a location point in joint coordinates
Limitations
The joint variable and the location parameter must either have a group type
identical to the group parameter, or have the same number of coordinates.

The values of the configuration argument (the long type parameter) can be

326 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

only: 0, 1 or 2, with the same meaning as ARMCMD.


Examples
? ToJoint (SCARA, #{1,2,3}, 1)

? ToJoint (SCARA, SCARA.Here, X)

?ToJoint(#{768.198 , 0 , 233.198 , 0 , 180 , 0},0b010)

J1 = ToJoint (SCARA, L1, 0)


See Also
TOCART

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 327 / 415


MC-Basic Commands 2.7

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.

The default tool transformation is the NULL transformation, which can be


expressed as TOOL = #{0,0,0,0}
Syntax
Tool = <robot location point>
Domain
ROBOT
Parameters
<robot location point> : Location
Return Value
returns the Tool Frame location in world coordinate

<return value>: Location


Examples
Scara.Tool = #{90, 180, 0, 0}

?Scara.UserFrame:WorkPiece:Base:Tool

{90 , 90 , 90 , 180}
See Also
BASE, USERFRAME, WORKPIECE, SELECTTOOL

328 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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>:

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1.TAddCmd
See Also
TORQUEFEEDBACK, TORQUEERROR, OPMODE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 329 / 415


MC-Basic Commands 2.7

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

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1.TCMD
Robot

?SCARA. TCMD
See Also
TORQUEFEEDBACK, OPMODE

330 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

TORQUEERROR
Description
Axis torque error value. The real-time (on-line) difference between
TorqueAddCommand and TorqueFeedback.

If this value exceeds the TorqueErrorMax, the torque-error collision


procedures (Stop and Disable) are activated according the user-defined setup
in TorqueErrorStopType and TorqueErrorDisableType. A motion error is
issued.
Short form
<axis>. TE
Syntax
?<axis>. TORQUEERROR
Domain
AXIS
Parameters
< axis >: any valid axis
Return Value
Returns the axis torque error value

<return value>:

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1. TE
See Also
TORQUEFEEDBACK, TORQUEADDCOMMAND, OPMODE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 331 / 415


MC-Basic Commands 2.7

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

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1.Tfb
Robot

?SCARA. Tfb
See Also
TORQUECOMMAND, TORQUEERROR, TORQUEADDCOMMAND,
OPMODE

332 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1.TGCmd
Robot

?SCARA.TGCmd
See Also
TORQUEGEARFEEDBACK, OPMODE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 333 / 415


MC-Basic Commands 2.7

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

Axis – Double, MINDouble to MAXDouble


Limitations
Read only
Examples
Axis

?A1. TgFbk
Robot

?SCARA. TgFbk
See Also
TORQUEGEARCOMMAND, OPMODE

334 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

TOTALTIME
Description
Returns the total time of the motion currently being executing.

Values:

-2 – Not applicable (PrfType = 0 or 1).

-1 – No motion active.

0 – Cannot happen as there are no motions of zero duration.

> 0 – Total time of running motion.


NOTE
Note that in case of blending the TotalTime/CurrentTime of the first motion of
the blending pair is returned! Once the blending ceased (only the second
motion is executing, i.e. the first movement finished) the time values of the
second motion are returned.
Short form
<element>.Ttime
Syntax
<element>?Ttime
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns the total time of the motion currently being executing

<return value>: Long, -2 to MaxInt


Limitations
Read only
Examples
Axis

?A1.totaltime
Robot

?SCARA.totaltime

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 335 / 415


MC-Basic Commands 2.7

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

<Return value> : string


Examples
Common shared ASCII8Str as string

? TOUTF8$(ASCII8Str)
See Also
TYPEOF

336 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

Examples include division by zero and out of range parameters in a move


command.

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

<code being Terminaled>

{Catch <Error Number X>

<code to execute when error X occurs> }

{Catch <MyError.num>

<code to execute when MyError occurs > }

{Catch Else

{code to catch allother errors} }

{Finally

<code to execute only if error occurred and was trapped> }

End Try ‘ End Try block


Limitations
Nesting of TRY blocks is allowed on condition that the nested TRY appears
only within the Catch block. The GOTO instruction is allowed within a Catch
section, but the referenced label must be within that section.
Examples
common shared appErroSCARA as error "Application error" 20561

program

try

' come code

catch 8001

' division by zero

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 337 / 415


MC-Basic Commands 2.7

catch appErroSCARA.num

Print "Application error"

end try

end program
See Also
ONERROR, PROGRAM_..._END_PROGRAM

338 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 339 / 415


MC-Basic Commands 2.7

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)

<return value>: Long, 0, 1, 2


Limitations
Read only
Examples
?TYPEOF(“…”)

‘ returns 0

?TYPEOF(TOASCII8$(“…”))

‘ returns 1

?TYPEOF(TOUTF8$(“…”))

‘ returns 2
See Also
TOASCII8$, TOUTF8$

340 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
U

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

<return value>: String


Limitations
Read only
Examples
PRINT UCASE$(“first step”)

Prints the following: FIRST STEP


See Also
LCASE$

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 341 / 415


MC-Basic Commands 2.7

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.

The default UserFrame transformation is the NULL transformation, which can


be expressed as SCARA.UserFrame = #{0,0,0,0}
Syntax
UserFrame = <robot location point>
Domain
ROBOT
Parameters
<robot location point> : Location
Return Value
returns the User Frame location in world coordinate

<return value>: Location


Examples
Scara.UserFrame = #{90, 180, 0, 0}

?Scara.UserFrame:WorkPiece:Base:Tool

{90 , 90 , 90 , 180}
See Also
BASE, TOOL, WORKPIECE, SELECTUSERFRAME

342 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value>: UTF-8 String


Limitations
Read only
Examples
?UTF$(256)

Prints the following: Ā


See Also
CHR$, UTFSTRING$, ASC

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 343 / 415


MC-Basic Commands 2.7

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

<string>: UTF-8 String

<ascii code>: Long, 0 to MaxLong


Return Value
<return value>: UTF-8 String
Limitations
Read only. Input string must be a UTF-8 string.
Examples
Common shared UTF8Str as String of UTF8 = UTF$(196) + UTF$(197)

? UTFSTRING$(10, UTF8Str) ‘ generates a string of 10Ä

? UTFSTRING$(10, 196) ‘ generates a string of 10Ä


See Also
STRING$, UTF$

344 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7
V

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

<return value>: Double precision, ± MaxDouble


Limitations
Read only
Examples
value = VAL("123 Example")

value = 123 (converts only the first legal numbers)

value = VAL("123 E124xa4m3p24le")

value = 123 (The system extracts the numbers)

value = VAL("1.2E-2")

value = 0.012

value = VAL("0xFF")

value = 255

?VAL("")

Prints the following: 0

?VAL("One hundred")

Prints the following: 0

?VAL("12e7a3")

Prints the following: 12e7

?VAL("65+32")

Prints the following: 65

?VAL("cos(32)")

Prints the following: 0

?VAL("321")

Prints the following: 321


See Also

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 345 / 415


MC-Basic Commands 2.7

STRD$, STRL$

346 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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:

{const} <type> <var_name> = <value>

The constants names are shown with the const word .


NOTE
Varlist command can only list user and global system variable, local system
variable will not be list.
Syntax
?VarList {<var_name>}
Parameters
{<var_name>}: variable name
Return Value
returns a list of the variable and constant names defined in the system

<return value>: String, format:

{const} <type> <var_name> = <value>


Limitations
Read only
Examples
?varlist

?varlist i*'Returns the variables that start with the letter i

LONG iVariable = 221

CONST LONG iConst = 1


See Also
PLSLIST, AXISLIST, GROUPLIST, TASKLIST

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 347 / 415


MC-Basic Commands 2.7

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:

{const} <type> <var_name> = <value>

The constants names are shown with the const word .


NOTE
Varlist command can only list user and global system variable, local system
variable will not be list.
Syntax
?VarList$ (<string>)
Parameters
<string>: String, variable name in string
Return Value
returns a list of the variable and constant names defined in the system

<return value>: String, format:

{const} <type> <var_name> = <value>


Limitations
Read only
Examples
?varlist$("")

?varlist$("i*")'Returns the variables that start with the letter i

LONG iVariable = 221

CONST LONG iConst = 1


See Also
PLSLIST, AXISLIST, GROUPLIST, TASKLIST

348 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 349 / 415


MC-Basic Commands 2.7

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,

350 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

For axis - Double

For group - Joint Data Type of the Robot

± Max Double
Limitations
Read only
Examples
Axis

?A1.VCmd
Robot

?SCARA.VCmd
See Also
VELOCITYCOMMANDCARTESIAN, VELOCITYFEEDBACK,
ACCELERATIONCOMMAND, POSITIONCOMMAND

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 351 / 415


MC-Basic Commands 2.7

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

<return value>: LOCATION, 0 to MaxDouble


Limitations
Read only
Examples
?Scara.VCMDCART
See Also
VELOCITYCOMMAND

352 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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:

SQRT((VCmd{1}-VFb{1})2 + (VCmd{2}-VFb{2})2 +(VCmd{3}-VFb{3})2)


Short form
<element>.VE
Syntax
?<element>.VelocityError
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the velocity following error, which is the difference between velocity
command and the velocity feedback

<return value>: Double


Limitations
Read only
Examples
Axis

?A1.VE
Robot

?SCARA.VE
Robot

?SCARA.VE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 353 / 415


MC-Basic Commands 2.7

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

<return value>: Double


Limitations
Read only
Examples
Axis

?A1.Vfb
Robot

?SCARA.VFb
See Also
VELOCITYCOMMAND

354 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value> : LOCATION, 0 to MaxDouble


Limitations
Read only
Examples
?Scara.VFBCART

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 355 / 415


MC-Basic Commands 2.7

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 group must be defined with a robot model (model !=1).

The value cannot be greater than VELOCITYMAXROT.

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

<numeric expression>: Double, 0.1 to Maxdouble


Limitations
Write, Nodal only
Examples
MoveS Scara #{10,20,30,0} vfrot = 6000
See Also
CIRCLE, MOVES

356 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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 group must be defined with a robot model (model !=1).

The value cannot be greater than VELOCITYMAXTRANS.

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

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Write, Nodal Only
Examples
MoveS Scara #{10,20,30,0} vftran=600
See Also
CIRCLE, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 357 / 415


MC-Basic Commands 2.7

VELOCITYMAX
Description
Defines the maximum allowed velocity of the element. The system limits
element velocity commands to this value.

In practice, it is limited by physical parameters (especially maximum motor


speed).
Short form
<element>.VMax
Syntax
<element>.VelocityMax = <value>
Domain
ELEMENT
Parameters
< element >: valid motion element

<value> : Double, Greater than zero


Limitations
Write only. To set the value within a task, the element must be attached to that
task (using the ATTACH command).
Examples
Axis

A1.Vmax = 300
Robot

SCARA.VMax=300
See Also
VELOCITYSCALE, ATTACH, VELOCITYOVERSPEED

358 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Read/Write, Modal Only
Examples
vmrot = 6000
See Also
VELOCITYROT, CIRCLE, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 359 / 415


MC-Basic Commands 2.7

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).

This parameter does not affect joint interpolated movements (MOVE).


Short form
<ROBOT>.vmtran
Syntax
<ROBOT>.vmtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Read/Write, Modal Only
Examples
vmtran = 6000
See Also
VELOCITYTRANS, CIRCLE, MOVES

360 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

VELOCITYOVERRIDE
Description
VELOCITYOVERRIDE modifies the actual element velocity by multiplying the
velocity by the specified override value.

Unlike other motion properties, it takes effect immediately.

The actual velocity rate of change is limited by the axis deceleration value.

Changing VELOCITYOVERRIDE takes 4 cycles (if the axis is moving), and


delays the task execution by this amount of time.

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

<value> : Double, 0.1 to 100


Limitations
write only

Actual velocity rate of change is limited by the axis deceleration value.


Examples
SCARA.VelocityOverride=20 ‘Set VORD to 20%
See Also
VELOCITYOVERRIDE

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 361 / 415


MC-Basic Commands 2.7

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

362 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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 group must be defined with a robot model (model !=1).

The value cannot be greater than VELOCITYMAXROT.

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

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Read/Write, Modal/Nodal
Examples
vrot = 6000
See Also
VELOCITYMAXROT, CIRCLE, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 363 / 415


MC-Basic Commands 2.7

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

<return value> : DOUBLE, 0 to MaxDouble


Limitations
Read only
Examples
?scara.velocityrotvalue
See Also
CIRCLE, MOVES

364 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

This properties used inside a motion command to override the permanent


value.

Active only when VelocitySettings is set to 1.


Short form
<element>.Vscale
Syntax
<element>.VelocityScale = <expression>

?<element>.VelocityScale
Domain
ELEMENT
Parameters
< element >: valid motion element

< expression > : Double, 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.VelocityScale =30

Move A1 TargetPos Vscale = 20


Robot

SCARA.VelocityScale =40

Move SCARA {100, 200} Vscale = 22


See Also
VELOCITYMAX, ATTACH, ACCELERATIONSCALE, JUMP

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 365 / 415


MC-Basic Commands 2.7

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 group must be defined with a robot model (model !=1).

The value cannot be greater than VELOCITYMAXTRANS.

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

<numeric expression>: Double, 0.1to Maxdouble


Limitations
Read/Write, Modal/Nodal
Examples
vtran = 6000
See Also
VELOCITYMAXTRANS, CIRCLE, MOVES, JUMP3, JUMP3CP,
VELOCITYTRANSFEEDBACKVALUE, VELOCITYTRANSVALUE

366 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<return value> : Double, 0 to MaxDouble


Limitations
Read only
Examples
?Scara.vtfbk
See Also
VELOCITYTRANS

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 367 / 415


MC-Basic Commands 2.7

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

<return value> : Double, 0 to MaxDouble


Limitations
Read only.
Examples
?SCARA.velocitytransvalue
See Also
VELOCITYTRANS, CIRCLE, MOVES

368 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

VGETJOBDATA
Description
If the VGetJobStatus command returns GET_DATA, you can get the Re-
spond Data from the station with the VGetJobData command.

The VGetJobData command returns an array of the Respond Data. For


example, if the station sends a JSON message {"Data": [{"X":1.0, "Y":2.0,
"Z":3.0}, {"X":4.0, "Y":5.0, "Z":6.0}]}, VGetJobData returns an array as fol-lows:

"1.0" "2.0" "3.0"

"4.0" "5.0" "6.0".


Syntax
VGetJobData (<StationName>, <JobName>, <Dimension> , <DataNum> ,
<Data>)
Parameters
<StationName>: any valid Vision Station, String

<JobName>: any valid Job belong to the Vision Station, String

<Dimension>: store the dimension of the Data feedback, Long

<DataNum>: store the group number of Data feedback, Long

<Data>: store the Data feedback, 2D String Array


Return value
Return the Vision Task Data.

<Dimension>: store the dimension of the Data feedback, Long

<DataNum>: store the group number of Data feedback, Long

<Data>: store the Data feedback, 2D String Array


Examples
? VGetJobData ("S1", "TEMPLATEJOB", Dim, Num, SDATA)
See Also
VGETJOBERROR, VGETJOBSTATUS, VRUNJOB

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 369 / 415


MC-Basic Commands 2.7

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

<JobName>: any valid Job belong to the Vision Station, String

<ERROR>: store the error string, String


Return value
Return the function excuting status.

<ERROR>: store the error string.


Examples
RET = VGetJobStatus("S1", "PositionAdjustment2D", MYSTATUS,10000)

select RET

case GET_STATUS

print MYSTATUS ‘ deal with Respond Status

case GET_DATA

LOOPCTL = false

?VGetJobData(“S1”, “PositionAdjustment2D”, MYDIM,MYNUM,


ASDATA)

case GET_ERROR

LOOPCTL = false

?VGetJobError(“S1”, “PositionAdjustment2D”, MYERR)

end select
See Also
VGETJOBDATA, VGETJOBSTATUS, VRUNJOB

370 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<JobName>: any valid Job belong to the Vision Station, String

<Timeout>: the time-out period of the TCP connection, Long, unit ms

<ERROR>: store the error string, String


Return value
Return the Vision Task status.

<ERROR>: store the error string.


Examples
?VRunJob(“S1”, “PositionAdjustment2D”, 5000)

LOOPCTL = true

while LOOPCTL

RET = VGetJobStatus(“S1”, “PositionAdjustment2D”,

MYSTATUS, 10000)

select RET

case GET_STATUS

print MYSTATUS ‘ deal with Respond Status

case GET_DATA

LOOPCTL = false

case GET_ERROR

LOOPCTL = false

end select

end while
See Also
VGETJOBDATA, VGETJOBERROR, VRUNJOB

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 371 / 415


MC-Basic Commands 2.7

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

372 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

< Pix_X >: Given position in X-axis of Pix coordinate, Double

< Pix_Y >: Given position in Y-axis of Pix coordinate, Double

< Pos_X >: return position in X-axis of Cartesian coordinate, Double

< Pos_Y >: return position in Y-axis of Cartesian coordinate, Double


Return value
< Pos_X >: return position in X-axis of Cartesian coordinate, Double

< Pos_Y >: return position in Y-axis of Cartesian coordinate, Double


Examples
VPixelToPos("S1",PIX,PIY,PX,PY)
See Also
VRUNJOB, VRUNJOBFULL, VRECEIVEDATA

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 373 / 415


MC-Basic Commands 2.7

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

< RecState >: return the command sending state, Long

< 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

< RecState >: return the command sending state, Long


Examples
VOpenTcp(“VS1”)VSendCmd("VS1","TrigerStart",lState)If lState then
VReceiveData("VS1",SDATA,lState, 1000)End if
See Also
VPIXELTOPOS, VRUNJOB

374 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<JobName>: any valid Job belong to the Vision Station, String

<Timeout>: the time-out period of the TCP connection, Long, unit millisecond
Return value
Return the function excuting status.

<return value>: Long


Examples
?VRunJob("S1", "TEMPLATEJOB", 5000)
See Also
VRUNJOBFULL, VRECEIVEDATA, VGETJOBDATA, VGETJOBSTATUS,
VGETJOBERROR, VOPENTCP, VPIXELTOPOS, VSENDCMD, VSTOPJOB

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 375 / 415


MC-Basic Commands 2.7

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”.

The “VRunJobFull” command is a simplified command without details. If you


want to define job status-related operations, do not use it..
Syntax
VRunJobFull (<StationName>, <JobName>, <Timeout>, <Dimension> ,
<DataNum> , <Data>, <ERROR>)
Parameters
<StationName>: any valid Vision Station, String

<JobName>: any valid Job belong to the Vision Station, String

<Timeout>: the time-out period of the TCP connection, Long, unit millisecond

<Dimension>: store the dimension of the Data feedback, Long

<DataNum>: store the group number of Data feedback, Long

<Data>: store the Data feedback, 2D String Array

<ERROR>: store the error string, String


Return value
Return the function excuting status.

<Dimension>: store the dimension of the Data feedback, Long

<DataNum>: store the group number of Data feedback, Long

<Data>: store the Data feedback, 2D String Array

<ERROR>: store the error string, String


Examples
?VRunJobFull ("CAMERA", "GET_POINTS", 5000, LDIM, LNUM, SDATA,
SERROR)
See Also
VRUNJOB, VCLOSETCP, VPIXELTOPOS, VSTOPJOB

376 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

VSENDCMD
Description
This command is used to send a user-defined string via TCP IP protocol.

This command can not be used before command VOpenTcp is executed.


Syntax
VSendCmd (<StationName>, <Command> , <CmdState>)
Parameters
<StationName>: any valid Vision Station, String

< Command >: command message will be sent to vision station, String

< CmdState >: return the command sending state, Long


Return value
< CmdState >: return the command sending state
Examples
VOpenTcp(“VS1”)

VSendCmd("VS1","TrigerStart",lState)
See Also
VRUNJOB

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 377 / 415


MC-Basic Commands 2.7

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

Off – disable the vsmode


Domain
ROBOT
Examples
SCARA.VSmode = On

MOVE SCARA {0,0,0,0}


See Also
MOVE, JUMP, CIRCLE, MOVES, JUMP3, JUMP3CP

378 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<JobName>: any valid Job belong to the Vision Station, String


Examples
VStopJob ("S1", "TEMPLATEJOB")
See Also
VRUNJOBFULL, VRUNJOB

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 379 / 415


MC-Basic Commands 2.7
W

WAIT
Description
This command stops the program until some conditions are fulfilled.

There are different types of condition can be used in <condition>. Condition is


composed of <expression> <operator> <value>and condition only supports IO
command.

Timeout can be set for wait command. If timeout is not set, program will
continue waiting until conditions are fulfilled.

Digital condition:

<expression> includes signal name

<operator> includes, '=', '<>'

<value> is Long

Analog condition:

<expression> includes signal name

<operator> includes, '=', '>', '<', '>=', '<=' and '<>'

<value> can be Long or Double

Edge condition:

<expression> includes signal name

<operator> is '='

<value> can be 'edge', 'on+' and 'off-'


Syntax
wait <condition> { and/or <condition> } { tmout = <timeout> }
Parameters
<condition>: I/O related conditions, including digital or analog signal.
conditions can be connected by 'and' or 'or' to be a compound condition.

<timeout>: Long, 1 to 86400000


Limitations
Attachment is required.
Examples
wait singal2 = 1 and signal2 = 0

wait signal3> 1 or signal4 < 2 tmout = 10000

wait signal5= On+


See Also
GETIO, SETIO

380 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

Move SCARA {10,0,0,0}

WaitForMotion SCARA

Move SCARA {20,0,0,0}

Detach SCARA
See Also
MOVE, STARTTYPE, SLEEP

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 381 / 415


MC-Basic Commands 2.7

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>

<code to execute as long as condition is true>

End While
Parameters
< condition >:Long, while condition expression
Examples
While A1.IsMoving = 1 ‘wait for profiler to finish

sleep 20

End While

While A2.VelocityFeedback < 1000

Print "Axis 2 Velocity Feedback still under 1000"

End While
See Also
FOR_..._NEXT, DO_..._LOOP, PROGRAM_..._END_PROGRAM

382 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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.

There are 4 ways to use the With statement:

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).

A GOTO command is not allowed inside a WITH block; an error is flagged


(Local With).
Examples
A1.VMax=5000

A1.Vord=5000

A1.VCruise=3000

A1.PEMax=10

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 383 / 415


MC-Basic Commands 2.7

A1.PESettle=0.01

Move A1 100

Can be simplified using:

With A1

VMax=5000

Vord=5000

VCruise=3000

PEMax=10

PESettle=0.01

Move 100

End With
See Also
WITHGLOBAL, PROGRAM_..._END_PROGRAM

384 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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:

New WithGlobal statement, declared in every scope.

"reset all" command applied within the Terminal.

Local With that valid only as the local task runs.


NOTE
This command usually sets on the CONFIG.PRG file.

Unlike using local/Terminal WITH statement - which require With..... → End


With methods, when using the "WithGlobal" statement, there's NO need to
declare "End WithGlobal".
Syntax
WithGlobal <element name>
Parameters
<element name>:any valid motion element
Limitations
WithGlobal commands can't be nested, As there is no End WithGlobal
statement.
Examples
A1.VMax=5000

A1.VCruise=3000

A1.PEMax=10

A1.PESettle=0.01

Move A1 100

Can be simplified using:

WithGlobal A1

VMax=5000

VCruise=3000

PEMax=10

PESettle=0.01

Move 100
See Also
PROGRAM_..._END_PROGRAM, WITH

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 385 / 415


MC-Basic Commands 2.7

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.

For SMOVE motion command, it supports PLS triggered by index which


means that specified pls can triggered at a certain index of the point array
given during SMOVE motion. Please be noted that the point array index points
to the index of array used for SMOVE motion command to execute.

PLS triggered by index ONLY supports SMOVE motion commands.


Syntax
{MOVE|MOVES|CIRCLE|...} {<element name>} {nodal assignments}
{WithPLS= <pls name>} ...
Parameters
<element name>:any valid motion element

<pls name> : the name of position trigger


Limitations
The PLS position data must be monotonic.

Up to 16 nodal PLS'es can be give in one line


Examples
Move SCARA {0, 0, 0, 0} withpls = pls1
See Also
JUMP, JUMP3, JUMP3CP, MOVE, MOVES, SMOVE

386 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

WORKPIECE
Description
WorkPiece is a Robot property which informs the system to use the specified
location as the workpiece transformation.

It defines the position and orientation of work-piece relative to the USER


FRAME reference.

The default base transformation is the NULL transformation, which can be


expressed as SCARA.WorkPiece = #{0,0,0,0}
Syntax
WorkPiece = <robot location point>
Domain
ROBOT
Parameters
<robot location point> : Location
Return Value
returns the Work Piece Frame location in world coordinate

<return value>: Location


Examples
Scara .WorkPiece = #{90, 180, 0, 0}

?Scara.UserFrame:WorkPiece:Base:Tool

{90 , 90 , 90 , 180}
See Also
BASE, TOOL, USERFRAME

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 387 / 415


MC-Basic Commands 2.7
X

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Xmax = 60
See Also
XMIN, YMAX, ZMAX, MOVES

388 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Xmin = 60
See Also
YMIN, XMAX, ZMIN, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 389 / 415


MC-Basic Commands 2.7
Y

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Ymax = 60
See Also
XMAX, YMIN, ZMAX, MOVES

390 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Ymin = 60
See Also
XMIN, YMAX, ZMIN, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 391 / 415


MC-Basic Commands 2.7
Z

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Zmax = 60
See Also
XMAX, YMAX, ZMIN, MOVES

392 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands 2.7

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

<numeric expression> : Double, 0.1-maxdouble


Limitations
Read/Write, Modal Only
Examples
Zmin = 60
See Also
XMIN, YMIN, ZMAX, MOVES

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 393 / 415


MC-Basic Commands 2.7

Example

Through several classic samples to help users learn common commands quickly.

394 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

Examples of motion commands

'**********************************************************************************************************
'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

Pos1 = toCart(SCARA, HomePos) 'joint point convert to location point


if getDist(Pos1) > 10 then
'do something
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

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 395 / 415


MC-Basic Commands 2.7

jump HomePos limz = dLimZ VScale = 10 'jump to home position, no blend


waitformotion SCARA 'wait move finish

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

396 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

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
'**********************************************************************************************************

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 397 / 415


MC-Basic Commands 2.7

Examples of string processing

'**********************************************************************************************************
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

'Get the robot's current position


call getCurrentPosition

'Get vision data


call getVisionData

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])

'check the point whether reachable


try
jPos = toJoint(SCARA, locPos) 'check whether reachable
print "the point is reachable"
catch else
print "the point is unreachable"
end try

398 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

sVisionData = RIGHT$(sArrStr[5],1) 'get value of arm


' lLocation = INSTR(sArrStr[5],"arm=")
' sVisionData = mid$(sArrStr[5],lLocation + LEN("arm="), 1)

'set arm type


locPos.arm = val(sVisionData)

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

print "Current command location posion is ",setpoint


print "Current X command value is ",setpoint{1}

print "Current feedback location posion is ",here


print "Current X feedback value is ",here{1}

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 399 / 415


MC-Basic Commands 2.7

print "Current command joint posion is ",pcmd


print "Current J2 command posion is ",pcmd{2}

print "Current feedback joint posion is ",pfb


print "Current J2 feedback posion is ",pfb{2}

'convert to string, keep two decimals


sX = STRD$(setpoint{1},"%.2f")
sY = STRD$(setpoint{2},"%.2f")
sZ = STRD$(setpoint{3},"%.2f")
sA = STRD$(setpoint{4},"%.2f")

sCurrentCmdLocPos = "X=" + sX + ",Y=" + sY + ",Z=" + sZ + ",A=" + sA


print sCurrentCmdLocPos

end sub
'**********************************************************************************************************

400 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

Examples of data conversion

'**********************************************************************************************************
program

dim lData[16] as long


dim dData[4] as double
dim locPos as location of xyzr

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

'get float data, move to this point


locPos{1} = dData[1]' result is 225.2

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 401 / 415


MC-Basic Commands 2.7

locPos{2} = dData[2]' result is -175.1


locPos{3} = dData[3]' result is -10
locPos{4} = dData[4]' result is 90

'------------------------------------------------------------------
'convert double(64) type to long type
DoubleToLong(dData, lData, 4, 1)'1- big Endian; 0- little endian

'lData[*] can be mapped to a signal, transmitted to the PLC


?lData[1] ' result is 16492
?lData[2] ' result is 9830
?lData[3] ' result is 24576
?lData[4] ' result is 0

?lData[5] ' result is 49253


?lData[6] ' result is 58163
?lData[7] ' result is 16384
?lData[8] ' result is 0

?lData[9] ' result is 49188


?lData[10] ' result is 0
?lData[11] ' result is 0
?lData[12] ' result is 0

?lData[13] ' result is 16470


?lData[14] ' result is 32768
?lData[15] ' result is 0
?lData[16] ' result is 0

'------------------------------------------------------------------
'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

402 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

end program
'**********************************************************************************************************

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 403 / 415


MC-Basic Commands 2.7

Examples of collision detect


Description:
Detect whether robot collide with external environment through planning the
difference between the planned and actual velocities (velocity deviation
value). This function can reduce the damage to the robot when a collision
occurs, but it cannot completely avoid damage. In addition, these functions
cannot be used for the purpose of ensuring personal safety.

To reduce damage caused by collisions between the end of the arm or


gripper and the external environment, two functions are provided:
• Collision detection function
• Torque limiting function
Collision detection function:
When the collision detection function is enabled, it monitors the deviation.
between the planned speed and the actual speed of the robot's movement
in real-time. If this deviation exceeds the set speed deviation threshold
due to a collision, it is determined that a collision has occurred and the
robot should be immediately stopped.
Torque limiting function:

Sets the maximum output value of the servo torque.

After activating this function, the detected errors are classified into two

categories:

1:3358:Robot detected to have collided, and the driver is disabled.

2: Other errors except for collisions:

• Axis position tracking error-related errors.

• Axis speed tracking error-related errors.

• Errors related to limited torque.

• Errors related to the driver layer.

The default setting of torque is unlimited, and the default setting of


CollsionDetect command is off. Restarting the controller will restore it to the
default value.

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:

1. To reduce collision and false detection risks, when collision detection is


enabled, the motion (1-3) in the buffer will run at a low speed when the
program continues.

2. When there are changes in the arm trajectory, or in some situations,


there is a probability of accidentally triggering the detection. The following
are some possible situations::

404 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

• Strong contact with the external environment, such as when picking


up or placing materials and contact with tooling.

• Unreasonable torque value settings.

• The collision detection speed error threshold is set too small.

• In Auto mode, when running in Step (single step) mode, the motion
degrades to a situation without blend.

• After an emergency stop or collision occurs, there is a very small


probability of occurrence when the program continues to run.

• The trajectory running speed is inconsistent with the speed during


learning.

• Modify the trajectory.

To reduce false detections when there is strong contact with the external

environment, the following measures can be taken:


• Reduce acceleration and deceleration when in strong contact with the external
environment.
• Reduce speed.
• Set the correct load value.

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

collision detection threshold, and turn on collision detection.


'**********************************************************************************************************
program
dim lCount as long = 3
Attach SCARA
power_on()
ResetPeakValue() 'Clear peak torque and peak velocity error of all axis.
SetDriveTorqueLimit(100, 100, 100, 100) 'Set torque limit 100
SetvelErrThreshold(100,100,100,100)
SCARA.CollisionDetect = off
While true
If lCount = 0 then
waitformotion SCARA
SetDriveTorqueLimit(J1.PeakTorque*1.2, J2.PeakTorque*1.2, J3.PeakTorque*1.3,
J4.PeakTorque*1.3)
SetvelErrThreshold(J1.PeakVelErr*1.2, J2.PeakVelErr*1.2, J3.PeakVelErr*1.3,
J4.PeakVelErr*1.3)
scara.CollisionDetect = on
end if
move {90,90,-100,0}
move {-90,-90,-100,0}
'move P1
'move P2
'move Pn
move {0,0,0,0}
waitformotion SCARA
if lCount >= 0 then
lCount = lCount - 1
end if
end while
end program
'**********************************************************************************************************

406 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

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

ITEMs Task Terminal Function


ABS √ √ √
ABSOLUTE √ √ √
ACCELCMDCART √ √ √
ACCELERATION √ √ √
ACCELERATIONCOMMAND √ √ √
ACCELERATIONERROR √ √ √
ACCELERATIONFEEDBACK √ √ √
ACCELERATIONMAX √ √ √
ACCELERATIONMAXROT √ √ √
ACCELERATIONMAXTRANS √ √ √
ACCELERATIONROT √ √ √
ACCELERATIONSCALE √ √ √
ACCELERATIONTRANS √ √ √
ACCEPT √ - √
ACOS √ √ √
ARMCMD √ √ √
ARMFBK √ √ √
ARRAYSIZE √ √ √
ASC √ √ √
ASIN √ √ √
ATAN2 √ √ √
ATN √ √ √
ATTACH √ - √
ATTACHEDTO √ √ √
ATTACHTO √ √ √
ATTACHTO$ √ √ √
AVERAGELOAD √ √ √
AXISLIST - √ -
BASE √ √ √
BIN$ √ √ √
BLENDDISTANCE √ √ √
BLENDENDPROTECTED √ √ √
BLENDMETHOD √ √ √
BLENDORIENTATION √ √ √
BLENDPERCENTAGE √ √ √
BLENDSTARTPROTECTED √ √ √
CALL √ - √
CASTJOINT √ √ √
CASTLOCATION √ √ √
CASTPOINT √ √ √
CHR$ √ √ √
CIRCLE √ - √
CLEARMSG √ √ √
CLOCK √ √ √
CLOSE √ √ √
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_ √ √ √
LONG
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_ √ √ √
DOUBLE
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_ √ √ √
STRING
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_ √ √ √
JOINT_OF

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 407 / 415


MC-Basic Commands 2.7

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 √ √ √

408 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

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 √ √ √

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 409 / 415


MC-Basic Commands 2.7

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 √ √ √

410 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

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 √ √ √

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 411 / 415


MC-Basic Commands 2.7

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 √ √ √

412 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

Common Syntax Error List

Index Description Reason Solution

Variable or constant Declare the same variable Change the variable


1
already declared. repeatedly. name.
1. The variable or constant is
not declared
Variable or constant does Declare the variable
2 2. The scope of the declared
not exist Token. in scope.
variable is outside the scope of
the calling variable
Declare the variable
in scope to view the
context of the
Instruction given in invalid Instruction mismatch between
3 instruction, reference
context current syntax and context.
the instruction
format, and enter the
correct pair keyword.
Refer to the Mc-basic
1. Use non-existent
manual to write the
4 Translator syntax error instructions
correct command
2. Incorrect command format
format.
1. The Program... End
Program doesn't come in
By blocking part of
pairs, missing one of the
the code, locate the
5 Program structure error keywords.
error part and modify
2. Syntax error in the
it.
"Program...End Program"
module.

Click error, the error


line will be displayed.
6 Syntax Error Command format error. Refer to the
instructions in the
MC-Basic manual.

String variables are assigned Assign a string


String too long ( limit = 83
7 more than 83 characters at a multiple times by
char )
time. using a "+" sign.
The declared array dimension
is greater than or less than the Declare a reasonable
Number of dimension does dimension used. array dimension or
8
not match declaration e.g: use it as the declared
dim shared aa[2][10] as long dimension.
?aa[1]
The index of the array must be
long type, possibly using a Change the type of
string type or double type as the index number
Wrong index type. Index the index. variable, or use the
9
must be of long type e.g: correct variable or
dim shared aa[2] as long constant as the index
dim shared a as string number.
?aa[a]
Left variable and Right
variable are of different types.
Modifies left variable
e.g:
10 Wrong input type or the type of right
dim shared aa[2] as long
variable.
dim shared an as string
aa[1] =a

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 413 / 415


MC-Basic Commands 2.7

Index Description Reason Solution


1. Use keywords as
Name is a reserved variable/function names.
command name or 2. The name of the variable or Change the declared
11
contains invalid symbols function is reserved by the variable name.
Token system. e.g:
dim shared dim as long =2
The PLS used was not added
to the "Project Editor-Project
Add and config on
settings-position Trigger"
the "Project Editor-
page.
12 Undefined pls in command Project settings-
e.g: Move SCARA PL2
position Trigger"
withpls=PT_bb
page.
(PT BB is add in the
configuration page)
The declared function
1. Modify the type of
parameter variable has a
function variable
different type from the passed
actually passed.
Variable passed by parameter variable .
2. Use correct
reference has another type e.g:
13 variables to pass
as in subroutine/function dim cc as string
values
declaration ?aa(cc)
3. Change the
function aa( bb as long) as
declared parameter
long
variable type.
end function
The arguments passed are
constants, but the function
Cannot pass constants, arguments are declared as
returned values and variables Prefix the parameter
14 complex expressions by e.g: with the keyword
reference to a ?aa("11") "byval".
subroutine/function function aa( bb as string) as
long
end function
Function return
values should be
This function has no return No return value is written added, but always do
15
value inside the function. not affect running.
(Refer to function
command format)
Cannot declare a protected The declared function or Change the function
16 function or variable in a variable name is the same as name or variable
user context the system function name. name.
Module keywords are not Module keywords are
paired. not paired. Please
If/While/For block e.g: Find unpaired block
17
mismatch if true then modules and add or
end if delete block
end if keywords.
Call a Function without Assign the return
assigning the return value to value of a function to
the variable or using "?" Print a variable or add a
This is not a subroutine, out the return value. "?" before the
18
but this is a function e.g: function name
call aa
function aa as long
end function

414 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024


MC-Basic Commands

Index Description Reason Solution

Calls to subroutine with no


arguments didn't use " call <
function name >" form.
Modify the format of
Assign the subroutine return
This is not a function, but the called function.
19 value to a variable.
this is a subroutine (Refer to sub
e.g:
instruction format)
?aa
sub aa
end sub
Confirm the usage of
1. The file or folder does not
files/folders and
20 Cannot remove file/folder exist
close them before
2. The file/folder is being used
deleting them.

MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 415 / 415

You might also like