Dobot Lua Syntax Guide (MG400&M1Pro)
Dobot Lua Syntax Guide (MG400&M1Pro)
Introduction 1.1
1.4 Jump Movement, Jump parameters can be set in this command 1.2.4
1.5 Jump Movement, Jump parameters are called by Arch index 1.2.5
1.6 Move to the Cartesian offset position in a point to point mode 1.2.6
2.5 CP 1.3.5
3 IO 1.4
3.1 DI 1.4.1
3.2 DO 1.4.2
5 Pose 1.6
1
5.3 Cartesian point offset 1.6.3
6 TCP 1.7
8 Modbus 1.9
8.3 Read the value from the Modbus slave coil register address 1.9.3
8.5 Read the value from the Modbus slave discrete register address 1.9.5
8.6 Read the value from the Modbus slave input register address 1.9.6
8.7 Read the value from the Modbus slave holding register address 1.9.7
9.3 Set X,Y axes offset under the set User coordinate system 1.10.3
10 Pallet 1.11
10.5 Set the next pallet layer index which is to be operated 1.11.5
10.6 Get the current pallet layer index 1.11.6
2
10.9 Release palletizing instance 1.11.9
10.10 The robot moves from the current position to the first stack position as the configured stack
assembly path 1.11.10
10.11 The robot moves from the current position to the transition point as the configured stack
dismantling path 1.11.11
11 Vision 1.12
3
Program Guide
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 15:03:14
4
1 Motion Commands
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
5
Point to Point, the target point is Cartesian point
Function:
MovJ(P)
Or:
Required parameter: P,Indicate target point, which is user-defined or obtained from the points list. Only
Cartesian point is supported.
Optional parameter: {CP=1, SpeedJ=50, AccJ=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
6
Linear Movement
Function:
MovL(P)
Or:
Required parameter: P, Indicate the target point, which is user-defined or obtained from the points list. Only
Cartesian point is supported.
Optional parameter: {CP=1, SpeedL=50, AccL=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
7
Point to point, the target point is Joint point
Function:
JointMovJ(P)
Or:
Required parameter: P,Indicate the target point, which is user-defined or obtained from the points list. Only
joint point is supported.
Optional parameter:{CP=1, SpeedJ=50, AccJ=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-03-03 17:41:10
8
Jump Movement, Jump parameters can be set in
this command
Function:
Description: Jump Movement. The jump parameters can be set in this command.
Required parameter: P, Indicate the target point, which is user-defined or obtained from the points list. Only
Cartesian point is supported.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:21:39
9
1.5 Jump Movement, Jump parameters are called by
Arch index
Function:
Description: Jump Movement. The jump parameters are called by Arch index.
Required parameter: P, Indicate the target point, which is user-defined or obtained from the points list. Only
Cartesian point is supported.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 15:27:01
10
Move to the Cartesian offset position in a point to
point mode
Function:
Or:
Required parameter: {OffsetX, OffsetY, OffsetZ, OffsetR}, X, Y, Z, R axes offset in the Cartesian coordinate
system.
Optional parameter: {CP=1, SpeedJ=50, AccJ=20}. You can double-click to inset the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
11
Move to the Cartesian offset position in a straight
line
Function:
Or:
Required parameter: {OffsetX, OffsetY, OffsetZ, OffsetR} , X, Y, Z ,R axes offset in the Cartesian coordinate
system.
Optional parameter: {CP=1, SpeedL=50, AccL=20}. You can double-click to inset the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
12
Linear movement in parallel with output
Function:
Or:
Description: Linear movement in parallel with output . Multiple digital output ports can be set.
Required parameter:
P, Indicate the target point, which is user-defined or obtained from the points list. Only Cartesian point is
supported.
{Mode, Distance, Index, Status},{Mode, Distance, Index, Status},...: Multiple digital output ports can be
set.
Mode: Set Distance mode. 0: Distance is a percentage; 1: Distance from the starting point, or from
the target point.
Distance: If the Mode is a percentage, it represents the percentage of the distance between the
starting point and the target point. If the Mode is a distance, it represents the distance from the
starting point, or from the target point. If the distance is set to positive, it indicates the distance from
the starting point; if set to negative, it indicates the distance from the target point.
Index: Digital output port. Value range: 1- 18
Status: Status of the digital output port.
Optional parameter: {CP=1, SpeedL=50, AccL=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
13
Point to point movement in parallel with output
Function:
Or:
Description: Point to point movement in parallel with output . Multiple digital output ports can be set.
Required parameter:
P, Indicate the target point, which is user-defined or obtained from the points list. Only Cartesian point is
supported.
{Mode, Distance, Index, Status},{Mode, Distance, Index, Status},...: Multiple digital output ports can be
set.
Mode: Set Distance mode. 0: Distance is a percentage; 1: Distance from the starting point, or from
the target point.
Distance: If the Mode is a percentage, it represents the percentage of the distance between the
starting point and the target point. If the Mode is a distance, it represents the distance from the
starting point, or from the target point. If the distance is set to positive, it indicates the distance from
the starting point; if set to negative, it indicates the distance from the target point.
Index: Digital output port. Value range: 1- 18
Status: Status of the digital output port.
Optional parameter: {CP=1, SpeedJ=50, AccJ=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 15:11:45
14
Arc Movement
Function:
Arc(P1, P2)
Or:
Description: Arc movement. This command needs to combine with other motion commands, to obtain the
starting point of an arc trajectory.
Required parameter:
P1, Middle point, which is user-defined or obtained from the points list. Only Cartesian point is
supported.
P2, End point, which is user-defined or obtained from the points list. Only Cartesian point is supported.
Optional parameter:{CP=1, SpeedL=50, AccL=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
15
Circle Movement
Function:
Or:
Description: Circle movement. This command needs to combine with other motion commands, to obtain the
starting point of a circle trajectory
Required parameter:
P1, Middle point, which is user-defined or obtained from the points list. Only Cartesian point is
supported.
P2, Middle point, which is user-defined or obtained from the points list. Only Cartesian point is
supported.
Count, Number of circles.
Optional parameter: {CP=1, SpeedL=50, AccL=20}. You can double-click to insert the command with
optional parameters.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
16
2 Motion Parameters
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
17
Joint Acceleration
Function:
AccJ(R)
Description: Set the joint acceleration rate . This command is valid only when the motion mode is MovJ,
MovJIO, MovJR, or JointMovJ .
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:28:42
18
Cartesian Acceleration
Function:
AccL(R)
Description: Set the Cartesian acceleration rate. This command is valid only when the motion mode is MovL,
MovLIO, MovLR, Jump, Arc, Circle.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:28:53
19
Joint Speed
Function:
SpeedJ(R)
Description: Set the joint velocity rate . This command is valid only when the motion mode is MovJ, MovJIO,
MovJR, or JointMovJ .
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:20:30
20
Cartesian Speed
Function:
SpeedL(R)
Description: Set the Cartesian velocity rate. This command is valid only when the motion mode is MovL,
MovLIO, MovLR, Jump, Arc, Circle.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:19:55
21
CP
Function:
CP(R)
Description: Set the continuous path rate. This command is invalid when the motion mode is Jump.
Required parameter: Continuous path rate. Value range: 0-100
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 11:01:34
22
Synchronization
Function:
Sync()
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
23
Set Load Parameters
Function:
Description: Set payload, X-axis offset, Y-axis offset and servo index.
Required parameter:
Optional parameter: index, servo parameter index。The default value range is 1 - 10.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
24
3 IO
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-25 09:35:43
25
DI
Function:
DI(Index)
Return:
When an port is set in the DI function, DI(index) returns the status (ON/OFF) of this specified input port.
When there is no port in the DI function, DI() returns the status of all the input ports, which are saved in
a table. For example, local di=(), the saving format is {num = 24 value = {0x55, 0xAA, 0x52}}, you can
obtain the status of the specified input port with di.num and di.value[n].
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 11:01:33
26
DO
Function:
DO(Index,ON/OFF)
Required parameter:
Queue command: When the robot system receives a command, this command will be pressed into the internal
command queue. The robot system will execute commands in the order in which the commands were pressed
into the queue.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:24:07
27
DOInstant
Function:
DOInstant(Index,ON/OFF)
Required parameter:
Immediate command: The robot system will process the command once received regardless of whether there is
the rest commands processing or not in the current controller;
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-03-03 17:41:10
28
4 Program Managing Commands
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
29
Motion command waiting
Function:
Wait(time)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
30
Blocking instruction issuance
Function:
Sleep(time)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
31
Pause program operation
Function:
Pause()
Description: Pause the running program. When the program runs to this command, robot pauses running
and you need to click Resume on the Software to recover the running.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 15:14:12
32
Start timing
Function:
ResetElapsedTime()
Description: Start timing after all commands before this command are executed completely. Use in
conjunction with ElapsedTime() command.
Required parameter: None
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
33
Stop timing
Function:
ElapsedTime()
Description: Stop timing and return the time difference. Use in conjunction with ResetElapsedTime()
command
Required parameter: None
Return: Time difference. Unit: ms
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
34
Get current time
Function:
Systime()
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
35
5 Pose
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
36
Get Cartesian coordinates
Function:
GetPose()
Description: Get the current pose of the robot under the Cartesian coordinate system. If you have set the
User or Tool coordinate system, the current pose is under the current User or Tool coordinate system.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
37
Get Joint coordinates
Function:
GetAngle()
Description: Get the current pose of the robot under the Joint coordinate system.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
38
Cartesian point offset
Function:
Description: Set the X, Y, Z.R axes offset under the Cartesian coordinate system to return a new Cartesian
coordinate point. he robot can move to this point in all motion commands except JointMovJ.
Required parameter:
P, Indicate the current Cartesian point, which is user-defined or obtained from the points list. Only
Cartesian point is supported.
{OffsetX, OffsetY, OffsetZ, OffsetR}: X, Y, Z, R axes offset in the Cartesian coordinate system.
Return: Cartesian point.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
39
Joint point offset
Function:
Description: Set the joint offset in the Joint coordinate system to return a new joint point. The robot can move
to this point only in JointMovJ command .
Required parameter:
P, Indicate the current joint point, which is user-defined or obtained from the points list. Only joint point is
supported.
{Offset1, Offset2, Offset3, Offset4}: J1 - J4 axes offset.
Return: Joint point.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
40
Cartesian point
Function:
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
41
Joint point
Function:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
42
6 TCP
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-25 09:35:43
43
Create TCP
Function:
Required parameter:
IsServer: Whether to create a server. false: Create a client; true: Create a server.
IP: IP address of the server, which is in the same network segment of the client without conflict.
Port: Server port. When the robot is set as a server, port cannot be set to 502 and 8080. Otherwise, it
will be in conflict with the Modbus default port or the port used in the conveyor tracking application,
causing the creation to fail.
Return:
Err:
0: TCP network is created successfully.
1: TCP network is created failed.
Socket: Socket object.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
44
Establish TCP connection
Function:
TCPStart(Socket, Timeout)
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
45
Receive TCP data
Function:
Required parameter:
Err:
0: Receiving data is successful.
1: Receiving data is failed.
Recbuf: Data buffer.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
46
Send TCP data
Function:
Description: Robot as a client sends data to a server or as a server sends data to a client.
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
47
Close TCP
Function:
TCPDestroy(Socket)
Return:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
48
7 UDP
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-25 09:35:43
49
Create UDP
Function:
Required parameter:
IsServer: Whether to create a server. false: Create a client; true: Create a server.
IP: IP address of the server, which is in the same network segment of the client without conflict.
Port: Server port. When the robot is set as a server, port cannot be set to 502 and 8080. Otherwise, it
will be in conflict with the Modbus default port or the port used in the conveyor tracking application,
causing the creation to fail.
Return:
Err:
0: UDP network is created successfully.
1: UDP network is created failed.
Socket: Socket object.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
50
Receive UDP data
Function:
Required parameter:
Err:
0: Receiving data is successful.
1: Receiving data is failed.
Recbuf: Data buffer.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
51
Send UDP data
Function:
Description: Robot as a client sends data to a server or as a server sends data to a client.
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
52
8 Modbus
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-25 09:35:43
53
Create Modbus master station
Function:
ModbusCreate()
Description: create Modbus master station, and establish connection with the slave station
Parameter:
err:
0: Modbus master station is created successfully
1: Modbus master station fails to be created
id: device ID of slave station, supporting at most five devices, range: 0~4
Note: When ip, port, slave_id is void, or ip is 127.0.0.1 or 0.0.0.1, connect the Modbus slave station. For
example, if you input any one of the following commands, it indicates connecting Modbus slave station.
ModbusCreate()
ModbusCreate(“127.0.0.1”)
ModbusCreate(“0.0.0.1”)
ModbusCreate(“127.0.0.1”,xxx,xxx) //xxx arbitrary value
ModbusCreate(“0.0.0.1”,xxx,xxx) //xxx arbitrary value
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-17 12:41:48
54
Disconnect with Modbus slave
Function:
ModbusClose()
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
Return:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-12 19:04:27
55
Read the value from the Modbus slave coil register
address
Function:
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
addr: starting address of the coils to read, range: 0~4095
count: number of the coils to read, range: 0 to 4096-addr
Return: coil value stored in a table, where the first value in the table corresponds to the coil value at the
starting address; data type: bit
Example
| Coil register address (e.g.: PLC) | Coil register address (Robot system) | Data type | Description |
| ------------------------ | ----------------------------- -| ------- | ---------- |
| 00001 | 0 | Bit | Start |
| 00002 | 1 | Bit | Pause |
| 00003 | 2 | Bit | Continue |
| 00004 | 3 | Bit | Stop |
| 00005 | 4 | Bit | Emergency stop |
| 00006 | 5 | Bit | Clear alarm |
| 00007~0999 | 6~998 | Bit | Reserved |
| 01001~04096 | 999~4095 | Bit | User-defined |
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
56
Set the coil register in the Modbus slave
Function:
Description: set the address value of coil register in the Modbus slave This command is not supported when
the coil register address is from 0 to 5
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
Addr: starting address of the coils to set, range: 6 - 4095
count: number of the coils to set, range: 0 to 4096-addr
table: coil value, stored in a table, data type: bit
Return: null
Example
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
57
Read the value from the Modbus slave discrete
register address
Function:
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
addr: starting address of the discrete inputs to read, range: 0~4095
count: number of the discrete inputs to read, range: 0 to 4096-addr
Return: coil value stored in a table, where the first value in the table corresponds to the input register value at
the starting address; data type: bit
Example
Emergency
00005 4 Bit
stop
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
58
Read the value from the Modbus slave input register
address
Function:
Description: read the input register value with the specified data type from the Modbus slave
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
addr: starting address of the input registers, range: 0 - 4095
count: number of the input registers to read, range: 0 ~ 4096-addr
type: data type
Empty: read 16-bit unsigned integer ( two bytes, occupy one register)
“U16”: read 16-bit unsigned integer ( two bytes, occupy one register)
“U32”: read 32-bit unsigned integer (four bytes, occupy two registers)
“F32”: read 32-bit single-precision floating-point number (four bytes, occupy two registers)
“F64”: read 64-bit double-precision floating-point number (eight bytes, occupy four registers)
Return: value of input register stored in a table, where the first value in the table corresponds to the input
register value at the starting address
Example 1
data = GetInRegs(id,2048,1)
Example 2
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
59
Read the value from the Modbus slave holding
register address
Function:
Description: Read the holding register value from the Modbus slave according to the specified data type
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
addr: starting address of the holding registers. Value range: 0 - 4095
count: number of the holding registers to read. Value range: 0 to 4096-addr
type: data type
Empty: read 16-bit unsigned integer ( two bytes, occupy one register)
“U16”: read 16-bit unsigned integer ( two bytes, occupy one register)
“U32”: read 32-bit unsigned integer (four bytes, occupy two registers)
“F32”: read 32-bit single-precision floating-point number (four bytes, occupy two registers)
“F64”: read 64-bit double-precision floating-point number (eight bytes, occupy four registers)
Return: coil value stored in a table, where the first value in the table corresponds to the input register value at
the starting address
Example 1:
data = GetHoldRegs(id,2048,1)
Example 2:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
60
Set the holding register in the Modbus slave
Function:
Parameter:
id: device ID of slave station, supporting at most five devices, range: 0~4
addr: starting address of the holding registers to set, range: 0 - 4095
count: number of the holding registers to set, range: 0 to 4096-addr
table: holding register value, stored in a table
type: datatype
Empty: read 16-bit unsigned integer ( two bytes, occupy one register)
“U16”: read 16-bit unsigned integer ( two bytes, occupy one register)
“U32”: read 32-bit unsigned integer (four bytes, occupy two registers)
“F32”: read 32-bit single-precision floating-point number (four bytes, occupy two registers)
“F64”: read 64-bit double-precision floating-point number (eight bytes, occupy four registers)
Return: null
Example 1
Example 2
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-08-11 16:37:48
61
9 Conveyor Tracking
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
62
Set conveyor number to create a tracing queue
Function:
CnvVison(CnvID)
Return:
0: No error
1: Error
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
63
Obtain status of the object
Function:
GetCnvObject(CnvID, ObjID)
Description: Obtain the information of the part on the conveyor to check whether the part is in the pickup
area .
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
64
Set X,Y axes offset under the set User coordinate
system
Function:
SetCnvPointOffset(OffsetX,OffsetY)
Description: Set X,Y axes offset under the set User coordinate system.
Required parameter:
0: No error
1: Error
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:27:19
65
Set time compensation
Function:
SetCnvTimeCompensation(Time)
Description: Set time compensation. This command is used for compensating the pick-up position offset in
the moving direction of the conveyor which is caused by taking photos with a time delay.
Return:
0: No error
1: Error
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
66
Synchronize the specified conveyor
Function:
SyncCnv(CnvID)
Description: Synchronize the specified conveyor. The motion commands used between SyncCnv(CnvID) and
StopSyncCnv(CnvID) only support MovL command.
Return:
0: No error
1: Error
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 17:14:42
67
Stop synchronous conveyor
Function:
StopSyncCnv(CnvID)
Descriptioon: Stop synchronizing the conveyor. The other commands following this command will not be
executed until this command running is completed.
Return:
0: No error
1: Error
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
68
10 Pallet
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
69
Instantiate matrix pallet
Function:
Or:
Optional parameter: {IsUnstack= true, User= 1}. You can double-click to insert the command with
optional parameters.
IsUnstack: Stack mode. Value range: true or false. true: Dismantling mode . false: Assembly mode. If
not set, the default is assembly mode
User: User coordinate system index. If not set, the default is User 0 coordinate system.
Return: Matrix pallet object.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-10-28 17:01:02
70
Instantiate teaching pallet
Function:
Or:
Optional parameter: {IsUnstack= true, User= 1}. You can double-click to insert the command with
optional parameters.
IsUnstack: Stack mode. Value range: true or false. true: Dismantling mode . false: Assembly mode. If
not set, the default is assembly mode
User: User coordinate system index. If not set, the default is User 0 coordinate system.
Return: Teaching pallet object.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-10-28 17:15:51
71
Set the next stack index which is to be operated
Function:
SetPartIndex(Pallet, Index)
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
72
Get the current operated stack index
Function
GetPartIndex(Pallet)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
73
Set the next pallet layer index which is to be
operated
Function:
SetLayerIndex(Pallet, Index)
Required parameter:
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
74
Get the current pallet layer index
Function:
GetLayerIndex(Pallet)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
75
Reset pallet
Function:
Reset(Pallet)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-06-04 15:51:09
76
Check whether the stack assembly or dismantling is
complete
Function:
IsDone(Pallet)
Return:
true: Finished.
false: Un-finished.
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
77
Release palletizing instance
Function:
Release(Pallet)
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
78
The robot moves from the current position to the
first stack position as the configured stack
assembly path
Function:
PalletMoveIn(Pallet)
Or:
Description: The robot moves from the current position to the first stack position as the configured stack
assembly path.
Optional parameter: {SpeedAB=20, SpeedBC=30, AccAB=20, AccBC=10, CP=20}. You can double-click
SpeedAB: Velocity rate when the robot moves from the transition point to the preparation point. Value
range: 1-100
SpeedBC: Velocity rate when the robot moves from the preparation point to the first stack point. Value
range: 1-100
AccAB: Acceleration rate when the robot moves from the transition point to the preparation point. Value
range: 1-100
AccBC: Acceleration rate when the robot moves from the preparation point to the first stack point. Value
range: 1-100
CP: Continuous path rate. Value range: 0-100
The stack assembly path and dismantling path are shown as follows. Point A is the transition point, which is
fixed or varies with the pallet layer. Point B is the preparation point which is calculated by the target point and
the set offset. Point C is the first stack point.
79
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:53
80
The robot moves from the current position to the
transition point as the configured stack dismantling
path
Function:
PalletMoveOut(Pallet)
Or:
Description: The robot moves from the current position to the transition point as the configured stack
dismantling path.
Optional parameter: {SpeedAB=20, SpeedBC=30, AccAB=20, AccBC=10, CP=20}. You can double-click
SpeedAB: Velocity rate when the robot moves from the preparation point to the transition point. Value
range: 1-100
SpeedBC: Velocity rate when the robot moves from the first stack point to the preparation point. Value
range: 1-100
AccAB: Acceleration rate when the robot moves from the preparation point to the transition point. Value
range: 1-100
AccBC: Acceleration rate when the robot moves from the first stack point to the preparation point. Value
range: 1-100
CP: Continuous path rate. Value range: 0-100
The stack assembly path and dismantling path are shown as follows. Point A is the transition point, which is
fixed or varies with the pallet layer. Point B is the preparation point which is calculated by the target point and
the set offset. Point C is the first stack point.
81
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-01-26 16:58:54
82
Vision
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 12:23:42
83
Initialize the connection to the camera
Function:
InitCam (“CAM0”)
Parameter:
0: Initialize successfully
1: Failed to initialize
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 16:35:18
84
Trigger the camera to take a picture
Function:
TriggerCam (“CAM0”)
Parameter:
0: Trigger successfully
1: Fail to trigger
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 15:30:25
85
Send data
Function:
SendCam (“CAM0”,“0,0,0,0”)
Parameter:
0: Send successfully
1: Failed to send
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 15:40:07
86
Receive data
Function:
RecvCam (“CAM0”,“number”)
Parameter:
err:
Example:
InitCam("CAM0")
SendCam("CAM0","0,0,0,0;")
while true do
local err,n,data = RecvCam("CAM0")
if err == 0 then
for i = 1, n do
pos.x=data[i][1] --data[i][1]assign to pos.x
pos.y=data[i][2] --data[i][2]assign to pos.y
pos.c=data[i][3] --data[i][3]assign to pos.r
pos.z = -20 --Set the height according to the actual situation
Move(pos)
end
elseif err == 1 then
print("Data receive timeout")
break
elseif err == 2 then
print("The data format is incorrectly and cannot be parsed")
break
elseif err == 3 then
print("Network disconnection")
break
end
end
DestroyCam("CAM0")
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 16:35:49
87
88
Close the camera
Function:
DestroyCam (“CAM0”)
Parameter:
0: Send successfully
1: Failed to send
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020 all right reserved,powered by GitbookRevision:
2021-09-16 16:15:56
89