Skip to main content

15. RL Commands

15.1 Variable Type
15.1.1 Int

image.png

15.1.2 Double 

image.png

15.1.3 Bool

image.png

15.1.4 String 

image.png

image.png

15.1.5 Array 

image.png

15.1.6 byte

image.png

15.1.7 clock

image.png

image.png

15.1.8 Implicit type conversion

image.png

15.1.9 Confdata

image.png

image.png

15.1.10 jointtarget

image.png

15.1.11 load

image.png

image.png

image.png

image.png

15.1.12 orient

image.png

15.1.13 pos

image.png

15.1.14 pose

image.png

image.png

15.1.15 robtarget

image.png

15.1.16 signalxx

image.png

image.png

15.1.17 speed

image.png

image.png

image.png

The system predefines some common speed variables, as shown in the following table.

image.png

15.1.18 tool

image.png

image.png

image.png

image.png

15.1.19 trigdata

image.png

15.1.20 wobj

image.png

image.png

15.1.21 zone

image.png

image.png

image.png

image.png

15.1.22 torqueinfo

image.png

15.1.23 SocketServer

image.png

15.1.24 SocketConn

image.png

image.png

15.1.25 FCBoxVol

image.png

image.png

15.1.26 FCSphereVol

image.png

15.1.27 FCXYZNum

image.png

15.1.28 FCCartNum

image.png

15.2 Basic variable and structure
All variable types supported by the RL command. The indivisible types, including int, double, bool, and string are basic variables (also known as primary variables), which are the foundation of all variable types. Combined by certain rules, the variable types are called structures.
15.2.1 Composition of structure
The combination rules for structures generally combine data with physical significance abstractly.
Example:
⚫ The structure pos combines three doubles into a position (xyz) in three-dimensional space.
⚫ The structure orient combines four doubles into a quaternion that describes the orientation.
⚫ The structure pose combines position (pos) and orientation (orient) into a pose parameter that describes the robot position.
15.2.2 Use of structure
Structures, serving as parameters for commands, can be performed in finer ways based on the scenarios. Its data can be modified directly via the specified RL commands.
Example 1:
Robtarget structure consists of: space position (pos), orientation (orient), configuration data (confdata), and external axes (double array). Their names are trans (pos), rot (orient), conf (confdata), extax (double), and users can access the structure members directly in the RL function via their names.
robtarget rob1 = ... // variable list or user-customized Cartesian variable
rob1.trans.x + = 20 // add the x of point position to 20
// In the structure definition of trans (pos), it contains three variables of x, y, and z
// The x of the last visit to rob is therefore rob1.trans.x
print (rob1.trans) // print the position data only

Example 2:
The following is available for the wobj frame:
// Taking default wobj0 as an example
wobj0.robhold // work object handheld (bool).
wobj0.ufprog // user frame programmed (bool, rarely used).
wobj0.ufmec // user frame mechanical unit usually for plating lines and tracking (string).
wobj0.oframe // work object frame pose
wobj0.oframe.x // work object frame pose x
wobj0.oframe.y // work object frame pose y
wobj0.oframe.z // work object frame pose z
wobj0.q1 // work object frame pose quaternion
wobj0.uframe_id// work object-related user frame id
Other complex structures can also refer to this method for structure access.
15.3 Function

Use of functions can simplify the code structure, improve the readability and reuse rate of code. The user can define the program segment as a new function that needs to be executed frequently so that it can be conveniently called in the main program at any time.
15.3.1 Function definition
15.3.1.1 PROC
PROC represents a function with no return value, defined as:
SCOPE PROC RoutineName()
…
…
//do something
…
…
ENDPROC
Where:
1. SCOPE is the function scope, which supports both the GLOBAL and LOCAL;
2. PROC is the defining keyword for functions with no return value;
3. RoutineName is the function name. The naming rules are the same as the variable naming rules.
For details, see the Variable naming rules.
Auxiliary programming, and PROC can be inserted in the following ways:

image.png

15.3.1.2 FUNC
FUNC is a function with a return value, defined as:
SCOPE FUNC RET RoutineName()
…
…
//do something
…
…
ENDFUNC
Where:
1. SCOPE is the function scope, which supports both the GLOBAL and LOCAL;
2. FUNC is the defining keyword for functions with no return value;
3. RET is the return value type;
4. RoutineName is the function name. The naming rules are the same as the variable naming rules.
For details, see the Variable naming rules.
Auxiliary programming, and FUNC can be inserted in the following ways:

image.png

15.3.2 Function call
When calling a function, enter the function name directly in the program editor, for example:
RoutineName()
Note:
⚫ Only other GLOBAL-level functions in this project or LOCAL-level functions in this module file can be called. Recursive calls are not supported. Cross calls between two sub-functions is also not supported.
⚫ Calling a function is treated as a separate program command in the compiler.
⚫ It is not allowed to define a function in a function.
15.4 Commands
15.4.1 Variable type conversion
15.4.1.1 ByteToStr

image.png

image.png

15.4.1.2 DecToHex

image.png

15.4.1.3 DoubleToByte

image.png

15.4.1.4 DoubleToStr

image.png

15.4.1.5 HexToDec

image.png

15.4.1.6 IntToByte

image.png

15.4.1.7 IntToStr

image.png

15.4.1.8 EulerToQuaternion

image.png

image.png

15.4.1.9 QuaternionToEuler

image.png

 

15.4.2 Motion commands
15.4.2.1 MoveAbsJ

image.png

15.4.2.2 MoveJ

image.png

image.png

15.4.2.3 MoveL

image.png

15.4.2.4 MoveC

image.png

image.png

15.4.2.5 MoveCF

image.png

image.png

15.4.2.6 MoveT

image.png

image.png

15.4.2.7 MoveSP

image.png

image.png

15.4.2.8 SearchL

image.png

image.png

15.4.2.9 SearchC

image.png

image.png

15.4.3 Trigger command
15.4.3.1 TrigIO

image.png

15.4.3.2 TrigReg

image.png

15.4.3.3 TrigVar

image.png

15.4.3.4 TrigL

image.png

image.png

15.4.3.5 TrigC

image.png

image.png

15.4.3.6 TrigJ

image.png

 

15.4.4 Force control commands
15.4.4.1 CalibSensorError

image.png

image.png

15.4.4.2 FcInit

image.png

15.4.4.3 SetControlType

image.png

15.4.4.4 SetCartNsStiff

image.png

15.4.4.5 SetJntCtrlStiffVec

image.png

15.4.4.6 SetCartCtrlStiffVec

image.png

image.png

15.4.4.7 SetJntTrqDes

image.png

15.4.4.8 SetCartForceDes

image.png

15.4.4.9 SetSineOverlay

image.png

Upper limit of collaborative model parameters:

image.png

15.4.4.10 SetLissajousOverlay

image.png

15.4.4.11 SetLoad

image.png

image.png

15.4.4.12 FcStart

image.png

15.4.4.13 FcStop

image.png

15.4.4.14 StartOverlay

image.png

15.4.4.15 PauseOverlay

image.png

15.4.4.16 RestartOverlay

image.png

image.png

15.4.4.17 StopOverlay

image.png

15.4.4.18 FcCondForce

image.png

15.4.4.19 FcCondPosBox

image.png

image.png

15.4.4.20 FcCondTorque

image.png

15.4.4.21 FcCondWaitWhile

image.png

15.4.4.22 FcMonitor

image.png

image.png

15.4.4.23 GetEndToolTorque

image.png

15.4.4.24 SetFcJointVelMax

image.png

image.png

15.4.4.25 SetFcCartVelMax

image.png

15.4.4.26 SetFcJointMomentumMax

image.png

image.png

15.4.4.27 SetFcJointEnergyMax

image.png

15.4.5 Drag and replay
15.4.5.1 ReplayPath

image.png

15.4.6 IO commands
15.4.6.1 SetDO

image.png

image.png

15.4.6.2 SetAllDO

image.png

15.4.6.3 SetGO

image.png

15.4.6.4 SetAO

image.png

15.4.6.5 PulseDO

image.png

image.png

15.4.6.6 PulseReg

image.png

15.4.7 Communication commands
In the RL program, the robot can communicate with external devices through both Ethernet and serial ports. A unified set of commands is designed for resource management and data sending and receiving, which ensures consistent use experience. 

image.png

15.4.7.1 OpenDev

image.png

image.png

15.4.7.2 SocketAccept

image.png

15.4.7.3 CloseDev

image.png

image.png

15.4.7.4 SendString

image.png

15.4.7.5 SendByte

image.png

image.png

15.4.7.6 ReadBit

image.png

15.4.7.7 ReadByte

image.png

15.4.7.8 ReadDouble

image.png

image.png

15.4.7.9 ReadInt

image.png

15.4.7.10 ReadString

image.png

15.4.7.11 GetSocketConn

image.png

15.4.7.12 GetSocketServer

image.png

image.png

15.4.7.13 GetBufSize

image.png

15.4.7.14 ClearBuffer

image.png

15.4.7.15 ReadOpcUaVarByName

image.png

15.4.7.16 WriteOpcUaVarByName

image.png

image.png

15.4.8 Network command
15.4.8.1 SocketCreate (expired)

image.png

15.4.8.2 SocketClose (expired)

image.png

15.4.8.3 SocketSendString (expired)

image.png

image.png

15.4.8.4 SocketSendByte (expired)

image.png

15.4.8.5 SocketReadBit(expired)

image.png

15.4.8.6 SocketReadDouble(expired)

image.png

image.png

15.4.8.7 SocketReadInt(expired)

image.png

15.4.8.8 SocketReadString(expired)

image.png

15.4.9 Logic commands
15.4.9.1 Return

image.png

15.4.9.2 Wait

image.png

15.4.9.3 WaitUntil

image.png

image.png

15.4.9.4 Break

image.png

15.4.9.5 IF…Else if…Else

image.png

15.4.9.6 Goto

image.png

15.4.9.7 For

image.png

image.png

15.4.9.8 Continue

image.png

15.4.9.9 Inzone

image.png

15.4.9.10 While

image.png

15.4.9.11 Pause

image.png

15.4.9.12 try/catch

image.png

image.png

image.png

The error types and standard error codes that try/catch can process:

image.png

image.png

image.png

image.png

15.4.9.13 SwitchCase

image.png

15.4.10 Home command
15.4.10.1 Home

image.png

15.4.10.2 HomeSet

image.png

15.4.10.3 HomeSetAt

image.png

15.4.10.4 HomeDef

image.png

15.4.10.5 HomeSpeed

image.png

15.4.10.6 HomeClr

image.png

15.4.11 Math command
15.4.11.1 Sin

image.png

15.4.11.2 Cos

image.png

15.4.11.3 Tan

image.png

15.4.11.4 Cot

image.png

15.4.11.5 Asin

image.png

15.4.11.6 Acos

image.png

15.4.11.7 Atan

image.png

15.4.11.8 Sinh

image.png

15.4.11.9 Cosh

image.png

15.4.11.10 Tanh

image.png

15.4.11.11 Exp

image.png

15.4.11.12 Ln

image.png

15.4.11.13 log10

image.png

15.4.11.14 pow

image.png

15.4.11.15 sqrt

image.png

15.4.11.16 ceil

image.png

15.4.11.17 floor

image.png

15.4.11.18 abs

image.png

15.4.11.19 rand

image.png

15.4.12 Bit operation
15.4.12.1 BitAnd

image.png

image.png

15.4.12.2 BitCheck

image.png

15.4.12.3 BitClear

image.png

15.4.12.4 BitLSh

image.png

15.4.12.5 BitNeg

image.png

15.4.12.6 BitOr

image.png

image.png

15.4.12.7 BitRSh

image.png

15.4.12.8 BitSet

image.png

15.4.12.9 BitXOr

image.png

15.4.13 String operations
15.4.13.1 StrFind

image.png

image.png

15.4.13.2 StrLen

image.png

15.4.13.3 StrMap

image.png

15.4.13.4 StrMatch

image.png

15.4.13.5 StrMemb

image.png

15.4.13.6 StrOrder

image.png

image.png

15.4.13.7 StrPart

image.png

15.4.13.8 StrSplit

image.png

15.4.13.9 StrToByte

image.png

15.4.13.10 StrToDouble

image.png

image.png

15.4.13.11 StrToInt

image.png

15.4.13.12 StrToDoubleArray

image.png

15.4.14 Operators
15.4.14.1 Basic operators
15.4.14.1.1 Arithmetic operators

Arithmetic operators include:

image.png

Arithmetic operators support data types of bool, byte, int, and double, and if different types of variables are added, subtracted, multiplied, and divided, they will trigger implicit conversion. The examples for arithmetic operators are as follows:
Example 1
VAR int a = 1
VAR int b = 2
VAR int c = -b //Negate
VAR int ac = a * c //Multiplication
Example 2
The two operators ++ and --, also known as unary operators, are operators that operate on an operand. RL does not distinguish between pre and post increment or decrement:
x = n++ //Means to add n by 1 and assign the n value to x
x = --n //Means to subtract n by 1 and assign the new value to x
Example 3
Implicit conversion results of addition, subtraction, multiplication, and division of different types of variables:

image.png

15.4.14.1.2 Logical operators
Logical operators support the operation of the basic data types, including

image.png

Logic and && expressions are true if the results on both sides are true, and the logic or || expression is true if one of the conditions of the two sides is true.
Example 1
The examples for other logical operators are as follows:
VAR int res = 1
while(res < 3) //Compare to determine whether res is less than 3
res++
endwhile
di5 = !di6 //Take logical negation
VAR int counter = 4
while(di7&&di8) //Calculate logical conjunction
if(counter == 5) //Whether it equals to
 break
endif
endwhile

15.4.14.1.3 Assignment operators

Assignment operators include:

image.png

The examples for assignment operators are as follows
VAR int num1 = 3
VAR int num2 = 4
num1 += num2 //Equivalent to num1 = num1 + num2, then num1 = 7.
num1 -= num2 //Equivalent to num1 = num1 – num2, then num1 = -1.
num1 *= num2 //Equivalent to num1 = num1 * num2, then num1 = 12.
num1 /= num2 //Equivalent to num1 = num1 / num2, then num1 = 0.
num1 %= num2 //Equivalent to num1 = num1 % num2, then num1 = 3.
All assignment operations of variables support implicit conversion. When the data types on the left and right sides of the assignment operation are inconsistent, the interpreter will attempt to trigger an implicit conversion to enable the program to continue running. When the conversion fails, the
program will report an error and stop. Bool, Byte, Int, and Double can be converted to each other. IO and register variables are special forms of the above four variables, and if they are used for assignment operations, they can also trigger implicit conversions.
If the return value of the function belongs to the above four variables, it can also be used as the right value of the assignment operation for assignment calculation.
Example 1
int tmp_num = 10.5 // 10
bool tmp_bool = 1 // true
tmp_bool = 0 // false
double tmp_d = 999 // 999.0
Example 2
// Register variables can be directly used to modify ordinary variables
double tmp_num = register0
// Register variables can be directly used for conditional judgment
WaitUntil(register0 == 10)
Example 3
int mem_ret = StrMemb(“Robotics”, 2, “aeiou”)
// The return value of StrMember is of type bool. If it is necessary to use an int type to receive the return value,
// The controller will not report an error but will perform an implicit conversion
// true -> 1, false -> 0

15.4.14.1.4 Other operators

image.png

The examples for the operators are as follows:
Example 1
VAR int num = arr[1] //Assign the first element of the array to num
VAR int num2 = (1+2)*3 //Using parentheses can change the order of operations, the value of num2 here is 9
Example 2
Define a robtarget variable pt1
pt1.trans.x = 200 // Change the x coordinate of the pt1 point to 200 using the "." operator
Use restrictions:
The "." operator does not support modifications to the A, B, C members of robtarget variables.
15.4.14.2 Operation priority

image.png

15.4.15 Clock commands
15.4.15.1 ClkRead 

image.png

image.png

15.4.15.2 ClkReset

image.png

15.4.15.3 ClkStart

image.png

15.4.15.4 ClkStop

image.png

15.4.16 Advanced commands
15.4.16.1 RelTool

image.png

image.png

15.4.16.2 Offs

image.png

15.4.16.3 ConfL

image.png

15.4.16.4 ConfJ

image.png

image.png

15.4.16.5 Conf

image.png

15.4.16.6 VelSet

image.png

15.4.16.7 AccSet

image.png

image.png

15.4.16.8 MotionSup

image.png

15.4.16.9 MotionSupPlus

image.png

15.4.16.10 MotionSupJointTrq

image.png

15.4.16.11 BreakLookAhead

image.png

image.png

15.4.16.12 GetRobotMaxLoad

image.png

15.4.16.13 GetRobotState

image.png

image.png

15.4.16.14 AutoIgnoreZone

image.png

image.png

image.png

15.4.16.15 MotionWaitAtFinePoint true/false

image.png

image.png

15.4.16.16 IgnoreOverride

image.png

15.4.16.17 SingAreaLockAxis4

image.png

image.png

15.4.16.18 SpeedRefresh

image.png

15.4.16.19 CSpeedOverride

image.png

15.4.16.20 SingAreaJointWay

image.png

image.png

15.4.16.21 SingAreaWrist

image.png

15.4.16.22 SetRobotJointsMaxAcc

image.png

image.png

15.4.16.23 SetRobotJointsMaxJerk

image.png

15.4.16.24 ResetJointKineLimit

image.png

15.4.16.25 SetTransmissionOverloadParams

image.png

15.4.16.26 SetAccRampTime

image.png

15.4.16.27 ResetAccRampTime

image.png

15.4.16.28 SetVarValue

image.png

image.png

15.4.16.29 SetStopAccRampTime

image.png

15.4.16.30 ResetStopAccRampTime

image.png

15.4.16.31 MotionSupJointTrq

image.png

15.4.17 Function commands
15.4.17.1 CRobT

image.png

image.png

15.4.17.2 CJointT

image.png

15.4.17.3 CalcJointT

image.png

15.4.17.4 CalcRobt

image.png

15.4.17.5 Print

image.png

image.png

15.4.17.6 Print_f

image.png

15.4.17.7 PoseMult

image.png

15.4.17.8 PoseInv

image.png

15.4.17.9 GetRobABC

image.png

15.4.17.10 SetRobABC

image.png

15.4.17.11 RotRobABC

image.png

image.png

15.4.17.12 OpMode

image.png

15.4.18 Register commands
15.4.18.1 ReadRegByName

image.png

15.4.18.2 WriteRegByName

image.png

15.4.18.3 ReadRegByteByName

image.png

15.4.18.4 WriteRegByteByName

image.png

image.png

15.4.19 End-effector commands
15.4.19.1 JodellGripInit

image.png

15.4.19.2 JodellGripMove

image.png

15.4.19.3 JodellGripStatus

image.png

15.4.19.4 JodellSuckInit

image.png

15.4.19.5 JodellSuckSet

image.png

image.png

15.4.19.6 JodellSuckStatus

image.png

15.4.19.7 RMRGMGripInit

image.png

15.4.19.8 RMCGripInit

image.png

15.4.19.9 RMRGMGripPosMove

image.png

image.png

15.4.19.10 RMCGripPosMove

image.png

15.4.19.11 RMRGMGripTrqMove

image.png

15.4.19.12 RMCGripTrqMove

image.png

15.4.19.13 RMRGMGripStatus

image.png

15.4.19.14 RMCGripStatus

image.png

15.4.19.15 RMRGMResetErr

image.png

15.4.19.16 RMCResetErr

image.png

15.4.19.17 RobotiqGripInit

image.png

15.4.19.18 RobotiqGripGetStatus

image.png

15.4.19.19 RobotiqGripMove

image.png

15.4.19.20 DhGripInit

image.png

15.4.19.21 DhGripGetStatus

image.png

image.png

15.4.19.22 DhGripMove

image.png