DobotStudio Pro User Guide (CR&Nova) V2.8.0 - 20240206 - en
DobotStudio Pro User Guide (CR&Nova) V2.8.0 - 20240206 - en
Preface
1 Getting Started
2 Connecting to Robot
3 Main Interface
3.1 Overview
3.2 Top toolbar
3.3 Control panel
4 Settings
4.1 Basic settings
4.2 Communication settings
4.3 Coordinate System
4.3.1 User coordinate system
4.3.2 Tool coordinate system
4.4 Load parameters
4.5 Motion parameters
4.6 Security setting
4.6.1 Collision detection
4.6.2 Joint brake
4.6.3 Installation
4.6.4 Sensitivity
4.6.5 Advanced functions
4.7 Power voltage (CCBOX)
4.8 Remote control
4.9 Home calibration
4.10 Manufacturer function
5 I/O Monitoring
6 Modbus
7 Global Variable
8 Dobot+
9 Programming
9.1 DobotBlockly
2
9.2 Script
10 Process
10.1 Trajectory playback
10.2 Conveyor tracking
11 Best Practice
Appendix A Modbus Register Definition
Appendix B Blockly Commands
B.1 Quick start
B.1.1 Control robot movement
B.1.2 Read and write Modbus register data
B.1.3 Transmit data by TCP communication
B.1.4 Palletize
B.2 Block description
B.2.1 Event
B.2.2 Control
B.2.3 Operator
B.2.4 String
B.2.5 Custom
B.2.6 IO
B.2.7 Motion
B.2.8 Motion advanced configuration
B.2.9 Modbus
B.2.10 TCP
Appendix C Script Commands
C.1 Lua basic grammar
C.1.1 Variable and data type
C.1.2 Operator
C.1.3 Process control
C.2 Command description
C.2.1 General description
C.2.2 Motion
C.2.3 Motion parameter
C.2.4 Relative motion
C.2.5 IO
3
C.2.6 TCP/UDP
C.2.7 Modbus
C.2.8 Program Control
C.2.9 Trajectory
C.2.10 Vision
C.2.11 Conveyor
C.2.12 SafeSkin
4
Preface
Purpose
This document describes the functions and operations of DobotStudio Pro for controlling six-axis robots
(CR and Nova series), which is convenient for users to fully understand and use the software.
Intended Audience
Customer
Sales Engineer
Installation and Commissioning Engineer
Technical Support Engineer
Change History
Improve the functions of collision detection, remote I/O and blockly programming in
the latest software (V2.5.0)
2022/11/30
Add best practice
Add description on DobotBlockly commands and Script commands
Adjust the catalogue and update the content based on the latest software (V2.4.0)
Add an appendix about Modbus register definition
2022/10/31
Divide the content about six-axis robots and four-axis robots into two separate
documents
Symbol Conventions
The symbols that may be found in this document are defined as follows:
5
Symbol Description
Indicates a hazard with a high level of risk which, if not avoided, could
DANGER result in death or serious injury
Indicates a hazard with a medium level or low level of risk which, if not
WARNING avoided, could result in minor or moderate injury, robot arm damage
6
1 Getting Started
DobotStudio Pro is a multi-functional control software for robot arms independently developed by Dobot.
With simple interface, easy-to-use functions and strong practicability, it can help you quickly master the
use of various robot arms.
This document mainly introduces how to use DobotStudio Pro to control six-axis robot arm (CR and Nova
series).
Win7
Win10
Win11
Procedure
Step 1: Double-click DobotStudio Pro installation package. Select a language for installation. Click Next.
Step 2: Click One Click Install, or start installation after setting the installation path in Custom options.
7
Step 3: After installation, click Experience Now to enter DobotStudio Pro.
Guidance
If you are using DobotStudio Pro for the first time, it is recommended to read this Guide in the following
order.
8
under the disabled state. See Installation for details.
4. I/O Monitoring: Know about the monitoring function provided by DobotStudio Pro. If you need to
install end plug-ins, see Dobot+ for configuration.
5. Programming/Process: Know about the programming and process module of DobotStudio Pro and try
creating your own project.
6. Remote Control: After developing a project, try running the project through remote control.
9
2 Connecting to Robot
DobotStudio Pro supports wired (LAN) and wireless (WiFi) connection to the robot.
NOTE
If the robot controller version is lower than 3.5.4.0, you need to open SMB1 protocol before
connecting to the robot. See (Optional) Open SMB protocol in this chapter for details.
Wired connection
Connect one end of the network cable to the LAN interface on the controller and the other end to the PC.
Change the IP address of the PC to make it on the same network segment as that of the controller. The
default IP address of the controller is 192.168.5.1, which can be modified in Communication settings.
Different Windows versions vary in modifying the IP address. This section takes Windows 10 as an
example to introduce specific operations.
Step 2: Right-click Properties on the currently-connected network. Then double-click Internet Protocol
Version 4(TCP/IPv4) in the pop-up window.
Step 3: Select Use the following IP address in "Internet Protocol Version 4(TCP/IPv4)" page, and change
the IP address, subnet mask and gateway of the PC. You can change the IP address of the PC to make it in
the same network segment as that of the controller without conflict. The subnet mask and gateway of the
PC must be the same as that of controller. For example, set the IP address to 192.168.5.100, and subnet
mask to 255.255.255.0.
10
Step 4: Start DobotStudio Pro. Select a device and click Connect.
Step 5: After connection, you will see the pop-up prompt information in DobotStudio Pro interface, and
the connection status turns to Connected. If you want to disconnect the robot, click Connected.
11
Wireless Connection
Before connecting to the robot, ensure that a WiFi module has been installed in the controller.
Step 1: Search Dobot controller WiFi name and connect it. The default SSID of WiFi is "Dobot {Product
Name}-{Serial Number}", where the serial number is the two 4-digit numbers connected by "-" in the
robot's S/N number (the S/N code is affixed to the nameplate on the base of the robot arm. For example,
the default SSID is "DobotCR5-4025-0731" for the CR5 with SN "4025-0731"), and WiFi password is
1234567890 by default. You can modify the WIFI SSID and password in Communication settings.
Step 2: Select a robot on the top of DobotStudio Pro interface and click Connect.
Step 3: After connection, you will see the pop-up prompt information in DobotStudio Pro interface, and
the connection status turns to Connected. If you want to disconnect the robot, click Connected.
12
2. Select SMB 1.0/CIFS File Sharing Support, and click OK.
13
14
3 Main Interface
3.1 Overview
3.2 Top toolbar
3.3 Control panel
15
3.1 Overview
No. Description
1 Top toolbar
2 Display the recent projects, which you can click to open quickly.
Click the icon on the right toolbar to display or hide the corresponding panels, including
4 Control, I/O, Modbus, Global Variable and Dobot+. The control panel is displayed by
default after DobotStudio Pro is connected to the robot successfully.
16
3.2 Top toolbar
No. Description
Click the icon, and the following items will pop up:
Settings: Click to open Settings page
Language: Select a language
1 Help: Access help functions, such as help documents, debugging tools, etc.
Check updates: View the version information of the software
About: View the components of the software
Enabling button. Click to switch the enabling status of the robot arm. See Enabling status
5 for details. The button is blue in disabled status, green in enabled status, and white in
power-off status
Drag the blue slider or click the speed bar to adjust the global speed ratio. The global speed
6 ratio is the calculation factor of the actual running speed of the robot arm. For the
calculation method, see Jog setting
Emergency stop button. Press the button in an emergency, and robot arm will stop running
7
and be powered off. See Emergency stop button for details.
Alarm log
If a point is saved incorrectly, for example, a robot moves to where a point is at a limited position or a
singular point, an alarm will be triggered. If an alarm is triggered when a robot is running, the alarm icon
turns into . You can check the alarm information on the Alarm page.
17
In this case, you can double click the alarm information to view the cause and solution, and click **Clear
Alarm**.
Enabling status
When the Enabling button is blue ( ), the robot arm is in the disabled status. Click the button, and
the "Load Enable Modification" window will pop up (the eccentric coordinate of the end load should
18
be set when the J6 axis is 0°, and the load value should not exceed the maximum allowable load
weight of the robot). After setting the parameters, click Confirm modification to enable the robot.
The robot arm starts to move slightly, and then the end indicator light turns green, indicating that the
robot arm is enabled. At the same time, the Enabling button moves to the right side, and the icon turns
green ( ) (yellow exclamation mark in the lower right corner indicates that the load is 0kg)
When the Enabling button is green, the robot arm is in the enabled status. Click the button, and a
confirmation box will be displayed. After your confirmation, the robot arm starts to be disabled. The
indicator light at the end of the robot arm turns blue, indicating that the robot arm is disabled. At the
same time, the Enabling button also turns blue.
When the Enabling button flashes blue, the robot is in the drag mode. In this case you cannot disable
the robot or control the robot motion (run projects, jog, Run To specified postures, etc.) through the
software.
Once the emergency stop button is pressed, the robot arm will stop running and be powered off, and the
emergency stop icon will turn red.
If you need to enable the robot arm again, please reset the emergency stop button, power on the robot and
then enable it.
19
NOTE
If the physical emergency stop button is pressed, the icon of the emergency stop button on the
software will not change. Before clearing the alarm, you need to reset the physical emergency stop
button first (generally by rotating the button clockwise).
20
3.3 Control panel
No. Description
1 Click to hide the panel. You can click Control in the right toolbar to display the panel.
2 Long-press the button to move the robot to its initial posture, which can be set in Settings.
4 Click to fold the control panel, and click it again to unfold the panel.
Click the drop-down list on the right of User coordinate system or Tool coordinate system
5
to select an index of the coordinate system that you need to use.
Dispaly the movement of the robot arm in real time when you are jogging or running the
6
robot arm.
21
moving when the jog button is released.
Step: The specific value (such as 0.1) indicates that the robot moves this distance
7 when you press the jog button. Long pressing the jog button can make the robot
moving continuously. In the Cartesian coordinate system, the unit of this value is mm,
and 0.1 represents a displacement of 0.1mm for each step. In the joint coordinate
system, the unit of this value is °, and 0.1 represents a displacement of 0.1° for each
step.
Jog the operation panel. The left column is jog buttons for Cartesian coordinate system,
and the right column is jog buttons for Joint coordinate system.
Take X+, X- as an example under Cartesian coordinate system: Click X+, X-: The
8 robot arm moves along X-axis in the positive or negative direction.
Take J1+, J1 as an example under Joint coordinate system: Click J1+, J1: The base
motor of robot arm rotates in the positive or negative direction.
22
4 Settings
4.1 Basic settings
4.2 Communication settings
4.3 Coordinate System
4.3.1 User coordinate system
4.3.2 Tool coordinate system
4.4 Load parameters
4.5 Motion parameters
4.6 Security setting
4.6.1 Collision detection
4.6.2 Joint brake
4.6.3 Installation
4.6.4 Sensitivity
4.6.5 Advanced functions
4.7 Power voltage (CCBOX)
4.8 Remote control
4.9 Home calibration
4.10 Manufacturer function
23
4.1 Basic settings
The Basic Settings page is used to see the device specifications and set the robot posture.
Select The robot will be automatically connected when the software starts next time, and the
software will try connecting to the current robot automatically when the software starts next time.
You can point View More to see more firmware version information.
Initial posture
The initial posture is a self-defined posture, which is the home posture by default, namely, all joint angles
are 0.
You can click Reset Initial Pose to modify the initial posture.
24
You can enter the angles of all joints, or move the robot to a specified posture and click Get Current Pose
to obtain the current angles of all joints. After confirming all joint angles, click OK to update the initial
posture.
Long press Move to Default Pose to move the robot to the initial point. Click Restore Default Pose to
recover the initial posture to the default posture.
25
Moving the robot to the package posture can reduce the robot space, making it easy to pack and transport.
Long press Move to this position to move the robot to the corresponding posture.
26
4.2 Communication settings
IP Setting
The robot can communicate with external device thourgh the LAN interface which supports TCP, UDP
and Modbus protocols. You can modify the IP address, netmask and gateway. The IP address of the robot
must be within the same network segment as that of the external device without conflict.
When the controller is CC162, there is only one LAN interface, and the address of this interface is
modified. When the controller is CCBOX, there are two LAN interfaces, and the address of the LAN1
interface is modified. The default IP address of the LAN1 interface of both controllers is 192.168.5.1.
If the robot arm is connected to the external device directly or through a switch, you need to check Set
IP manually, modify the IP address, netmask and gateway and click Apply.
If the robot arm is connected to the external device through a router, check Get IP automatically (the
IP address is automatically assigned by the router), and then click Apply.
WiFi Setting
The robot system can communicate with external device through WiFi. You can modify the WiFi name
and password and then restart the controller to make it effective. The default password is 1234567890.
27
28
4.3 Coordinate system
29
4.3.1 User coordinate system
When the position of workpiece is changed or a robot program needs to be reused in multiple processing
systems of the same type, you can create a coordinate system on the workpiece to simplify programming.
DobotStudio Pro supports 10 user coordinate systems, of which the User coordinate system 0 is defined as
the base coordinate system by default and cannot be changed.
NOTE
When creating a user coordinate system, make sure that the reference coordinate system is the base
coordinate system.
The user coordinate system is created by three-point calibration method. Move the robot to three points: A,
B, and C. Point A is defined as the origin and the line from point A to point B is defined as the positive
direction of X-axis. The line that point C is perpendicular to X-axis is defined as the positive direction of
Y-axis. The Z-axis can be defined based on the right-hand rule.
30
2. Select Three points setting in "Add User Frame: index2" page.
NOTE
When creating a user coordinate system, make sure that the reference coordinate system is
the base coordinate system, that is, the user coordinate system is 0 when you jog the robot.
31
Long pressing Run To can move the robot to the set points.
1. Jog the robot to the point P1 and click obtain on the P1 panel.
2. Jog the robot to the point P2 and click obtain on the P2 panel.
3. Jog the robot to the point P3 and click obtain on the P3 panel.
Now you can select a user coordinate system and jog the robot arm.
NOTE
When creating or modifying a user coordinate system, you can also select Input settings and directly
enter X, Y, Z, Rx, Ry and Rz values, then click OK.
Other operations
Modify a coordinate system: Select a coordinate system and click Modify. The procedure to modify a
coordinate system is the same as to add a coordinate system.
Copy a coordinate system: Select a coordinate system and click copy , and you will create a new
coordinate system the same as the selected one.
32
4.3.2 Tool coordinate system
When an end effector such as welding gun or gripper is mounted on the robot, the tool coordinate system is
required for programming and operating a robot. For example, when using multiple grippers to carry
multiple workpieces simultaneously, you can set a tool coordinate system for each gripper to improve the
efficiency.
DobotStudio Pro supports 10 tool coordinate systems. Tool coordinate system 0 is the base coordinate
system which is located at the robot flange and cannot be changed.
NOTE
When creating a tool coordinate system, make sure that the reference coordinate system is the base
coordinate system.
The tool coordinate system of six-axis robot is created by three-point calibration method (TCP +ZX): After
mounting the end effector, adjust the direction of the end effector to make TCP (Tool Center Point) align
with the same point (reference point) in three different directions for obtaining the position offset of the
end effector. Then jog the robot to three other points (A, B, C) for obtaining the angle offset.
33
2. Click Add.
NOTE
When creating a tool coordinate system, make sure that the reference coordinate system is
34
the base coordinate system, that is, the tool coordinate system is 0 when you jog the robot.
Long pressing Run To can move the robot to the set points.
1. Jog the robot to the reference point in the first direction, then click obtain on the P1 panel.
2. Jog the robot to the reference point in the second direction, then click obtain on the P2 panel.
3. Jog the robot to the reference point in the third direction, then click obtain on the P3 panel.
4. Jog the robot to the reference point in the vertical direction, then click obtain on the P4 panel.
5. Jog Z-axis along the positive direction to move the robot to another point, then click obtain on the P5
panel.
6. Jog X-axis along the positive direction to move the robot to point P6 (not in the same line with P4 and
P5). Click obtain on the P6 panel.
After adding or modifying a tool coordinate system, you can select a tool coordinate system in the control
panel and jog the robot arm.
NOTE
When creating or modifying a Tool coordinate system, you can also select Input settings or Three
points setting in Step 3.
Other operations
35
Modify a coordinate system: Select a coordinate system and click Modify. The procedure to modify a
coordinate system is the same as to add a coordinate system.
Copy a coordinate system: Select a coordinate system and click copy , and you will create a new
coordinate system the same as the selected one.
36
4.4 Load parameters
To ensure optimum robot performance, it is important to make sure the load and eccentric coordinates of
the end effector are within the maximum range for the robot, and that Joint 6 does not become eccentric.
Setting load and eccentric coordinates improves the motion of robot, reduces vibration and shortens the
operating time.
NOTE
Every time you enable the robot, a "Load Enable Modification" window will pop up which requires
you to set the load parameters. The parameters you set will be synchronized to the "Load Params"
page.
You need to set the eccentric coordinate of the load when J6 axis is 0°.
The load weight includes the weight of the end effector and workpiece, which should not exceed the
maximum load of the robot arm.
NOTICE
Incorrect load settings may cause abnormal collision detection alarms or the robot arm to be out of
control during dragging.
37
After setting the parameters, click OK.
Please set load and eccentric coordinates properly. Otherwise, it may cause errors or excessive shock, and
shorten the life cycle of parts.
38
4.5 Motion Parameters
The optimal motion parameters have been set before delivery, and are not recommended to be modified
without special requirements. If you feel that the robot speed is too high, you can adjust it downwards
according to your actual needs. If a higher speed is required, please contact technical support for a speed
increase solution.
Jog Setting
You can set the maximum speed and acceleration in the Joint coordinate system and Cartesian coordinate
system. Click Save after setting the parameters.
Clicking will restore all the values in the corresponding module to the default values.
Playback Setting
39
You can set the velocity, acceleration and jerk in the Joint coordinate system and Cartesian coordinate
system. Click Save after setting the parameters.
Actual robot speed/acceleration = set speed/acceleration × global speed ratio × set percentage in speed
commands when programming.
Clicking will restore all the values in the corresponding module to the default values.
40
4.6 Security setting
41
4.6.1 Collision detection
Collision detection is mainly used for reducing the impact on the robot to avoid damage to the robot or
external equipment. If collision detection is activated, the robot arm will suspend running automatically
when hitting an obstacle.
The higher sensitivity level you select, the smaller force the robot requires to stop after collision detection.
The safety level will be displayed in the connection panel on the top toolbar.
When the force required to stop is detected when you jog the robot, the "Collision Detection" window will
pop up. In this case, you need to resolve the cause of the collision and click Reset. If you need to operate
the software to resolve the collision cause, click Remind me in a minute to temporarily close the pop-up
window (a pop-up message will be displayed again in one minute).
42
Post-collision processing refers to the treatment after collision while the robot arm is running the project:
43
4.6.2 Joint brake
Braking prevents the servo motor shaft from moving when the servo driver is not in operation, so that the
motor keeps its position locked and ensures that the moving part of the machine will not move because of
its self weight or external force.
If you want to drag joints manually, you can enable the brake function, that is, hold the joint manually after
the robot arm is disabled, then click the button of the corresponding joint.
NOTICE
When enabling the function, hold the joint with your hand to prevent it from moving.
44
4.6.3 Installation
If the robot is mounted on a flat table or floor, you do not need to set in this page. However, if the robot is
ceiling mounted, wall mounted or mounted at an angle, you need to set the rotation angle and slop angle in
the disabled status.
Manual calibration
You can select a proper installation posture based on the actual condition.
Slop angle is the angle that a robot rotates counterclockwise around X-axis at the origin point.
Rotation angle is the angle that a robot rotates counterclockwise around Z-axis at the origin point.
Automatic calibration
After installing and enabling the robot, you can click Calibration and operate according to the pop-up
window to obtain the slop angle and rotation angle.
45
Click Save after calibration to save the settings.
46
4.6.4 Sensitivity
Sensitivity setting is mainly used to adjust the sensitivity of joints during running and dragging.
The lower the sensitivity is, the greater resistance there is during dragging.
47
4.6.5 Advanced functions
If you need to enable or disable the advanced functions, you can configure them in this page. It is
recommended to keep the default value if you do not have special requirements.
NOTE
48
4.7 Poewer voltage (CCBOX)
When the type of the controller is CCBOX, you need to set the input voltage range of the controller.
Please set according to the actual range of input voltage, with maximum voltage no more than 60V and
minimum voltage no less than 30V.
49
4.8 Remote control
External equipment can send commands to a robot (control and run a taught program file) in different
remote control modes, such as remote I/O mode and remote Modbus mode.
NOTE
You do not need to restart the robot control system when switching remote control mode.
No matter what mode the robot control system is in, the emergency stop switch is always
effective.
If the robot is running in the remote control mode, the project will stop running automatically
when you switch to other working modes.
Do not send control signals before the robot is powered on and initialized, otherwise it may
cause the robot to move abnormally.
After entering the remote control mode, the top toolbar will display the current mode. Click
"Running log" to view the running log of the remote mode. The following figure takes the
Remote I/O mode as an example.
Online mode
It is the default control mode. You can control the robot arm through DobotStudio Pro.
Remote Modbus
External equipment can control the robot arm in the remote Modbus mode.
50
The specific functions of Modbus registers are shown above. You can click Modify to edit it.
The procedure of running the project in the remote Modbus mode is described below.
Prerequisites
Procedure
1. Set Current mode to Remote-Modbus, and select an offline project (block program or script) for
running.
2. If you need to start multiple different projects through Modbus, click Advanced Setting. In Advanced
Settings, you can set Hold register address of the option project and configure the list of option
projects, as shown in the following figure.
51
3. Click Apply. Now the robot arm enters remote Modbus mode. Only the emergency stop command is
available.
4. Trigger the starting signal on the external equipment. The robot will move according to the selected
project file.
5. If the stop signal is triggered, the robot arm will stop moving and be disabled.
Remote IO
External equipment can control the robot arm in the remote IO mode.
52
The specific IO interface definition of the control system is shown in the figure above. You can click
Modify to edit it.
When the type of control cabinet is CCBOX, safe I/O and universal I/O share the same terminal. The
terminal configured as safe I/O cannot be configured as remote I/O.
Clicking Advanced Setting can configure multiple projects through group I/O.
53
1. Click + or - to increase or decrease the number of addresses assigned to group I/O. The more the
assigned addresses are, the more configurable projects are.
2. You can modify the assigned address through the drop-down list. The address assigned to group I/O
cannot be duplicated with remote I/O or safe I/O (CCBOX).
3. After assigning addresses, you can set optional projects (at least one) for each group IO value.
In remote I/O mode, before running the project, select the corresponding optional project by
setting the corresponding (blue refers to ON, and gray refers to OFF) group IO value.
Take assigning DI1~ DI4 in the figure above as an example:
DI1 is ON, DI2, DI3 and DI4 are OFF: select the first optional project;
DI1 and DI2 are ON, DI3 and DI4 are OFF: select the third optional project;
DI1~ DI4 are all ON: select the 15th optional project.
When all group IOs are set to OFF, it means selecting the main project configured in the
previous page.
4. Click Save to complete the configuration.
54
The procedure of running the project in the remote I/O mode is shown below.
Prerequisite
Procedure
1. Set Current mode to Remote I/O, and select an offline project (block program or script) for running.
2. Click Apply. Now the robot arm enters remote IO mode. Only the emergency stop command is
available.
3. (Optional) Trigger group I/O on external devices and select a project for running.
4. Trigger the starting signal. The robot will move according to the selected project file.
5. If the stop signal is triggered, the robot arm will stop moving.
55
4.9 Home calibration
After some parts (motors, reduction gear units) of the robot arm have been replaced or the robot has been
hit, the home point of the robot will be changed. In this case you need to reset the home point.
NOTE
Home calibration is used only when the home position changes. Please operate cautiously.
The home calibration function can be used after you enter the password (default password:
888888)
Move the robot to the home point according to the prompt in the page. Click Home Calibration in the
enabled status.
After operating the homing calibration, you can check the joint coordinates in the control panel. Now all
joint coordinates (J1-J6) are zero.
56
4.10 Manufacturer function
Manufacturer functions include automatic identification and collision detection switch. Improper operation
may cause robot anomaly and security risks. Please use it under the guidance of technical support.
57
5 I/O Monitoring
You can monitor and set the I/O status of the controller and the end tool in the I/O page. For the I/O
definition, refer to the IO description in the corresponding robot hardware guide. As different controllers
vary in the number of I/O, the screenshots in this document are for reference only.
No. Description
1 Click to hide the panel, and click I/O in the right toolbar to display the panel.
Click to add extended I/O, which can be used for monitoring Modbus communication. See
2
I/O extension for details.
3 Click to set I/O alias or whether to display. See I/O configuration for details
58
4 Click to fold the control panel, and click again to unfold the panel
I/O extension
After clicking OK, a new I/O will appear in the bottom of I/O panel. The monitoring function takes effect
only after you restart the controller.
Clicking x on the right of the extended I/O can delete the I/O.
I/O configuration
59
Select IO to display it in the monitoring page.
Enter the alias of the IO on the right side, and the alias will be displayed on the monitoring page. At
the same time, you can also call the corresponding IO through the alias in block programming and
script programming.
When the type of control cabinet is CCBOX, you can set digital input/output type to PNP (high-level
active) or NPN (low-level active), as shown in the figure below.
60
Monitoring
Controller I/O and Tool I/O page supports the following functions.
Output: Set the digital output or analog output. For digital output, you can click the corresponding switch
on the right side to switch its status. For analog output, you need to click Modify first, and then click
Confirm Modification after modifying the output value.
Monitor: Check the real status of the input and output. The dot on the right of the digital input indicates the
status of the corresponding DI. Grey means DI is not triggered, and green means DI is triggered.
Simulation: Simulate the status of digital input to facilitate debugging and running programs. Click the
status display area of the corresponding DI, and a setting window will pop up. Click Fictitious and select
DI Transformation, and the DI will turn to virtual trigger status (green dot), which is regarded as ON
logically. If you do not select DI Transformation, the DI will maintain its real status.
61
When the type of control cabinet is CC162, the analog input/output supports voltage or current mode.
Click Modify to select the corresponding mode, and click Confirm modification to switch the mode. The
unit of the value on the right side will change in real time. Note that the value of the analog input can only
be viewed rather than modified.
NOTE
This function needs to be used with the DIP switch, which is located inside the control cabinet. if you
need to set it, please contact Dobot technical support.
You can set the functions of each safe I/O interface in the Safe IO page. For details on the safe I/O, refer to
the IO description in the corresponding robot hardware guide.
When the type of control cabinet is CCBOX, safe I/O and universal I/O share the same terminal. The
terminal configured as remote IO cannot be configured as safe I/O.
62
NOTE
In actual use, please try to ensure that SI signal changes at an interval of over 150ms, otherwise SI
signal jump may cause anomaly in robot running status.
For example, when the protective stop reset input is not configured, the jump of the protective stop
input signal (the change interval is less than 150ms) may cause the robot not to automatically resume
operation after being paused. In this case, you need to solve the problem through the method below.
1. Pause the project through the software, and then continue to run the project.
2. Trigger the protective stop input signal again and remain over 150ms.
63
6 Modbus
Modbus module, serving as Modbus master, is used to connect Modbus slave.
No. Description
1 Click to hide the panel, and click Modbus on the right toolbar to restore it
2 Click to connect Modbus slave. See Connecting Modbus slave for details
3 Click to fold the control panel, and click again to unfold the panel
64
Slave IP: address of Modbus device.
Port: port number of Modbus communication.
Slave ID: slave device ID.
Function: select the function type of the slave device.
Address/Quantity: address and number of registers.
Scanning rate: time interval of scanning the slave station by the robot arm.
65
7 Global Variable
The module is used to configure and check the global variables.
After setting the global variable, you can call the variable through relevant blocks in block programming,
or call the variable through the variable name in script programming.
66
Global Hold:
When Global Hold is checked, any modification to the variable will be saved, and the modified value
will be saved regardless of exiting the script or powering off and restarting the robot.
When Global Hold is not checked, modifications to the variable are only effective when the script is
running. It will be restored to the initial setting value when exiting the script.
It should be noted that global variable names cannot duplicate lua's reserved keywords and the functions
and variable names already defined by Dobot.
67
Jerk, JerkR, JerkS, Jump, LimZ, Linear, Linear, LoadSet, LoadSwitch,
Log, LogFormat, MatrixPallet, MD, ModbusClose, ModbusCreate,
Move, MoveIn, MoveIO, MoveJ, MoveJIO, MoveJR, MoveOut, MoveR,
MoveToolR, MoveUserR, MoveWeave, NewPose, OFF, ON, PalletSync,
Pause, print, QuitScript, ReadDB, RecvCam, Release, RelJointMovJ,
RelMovJTool, RelMovJUser , RelMovLTool, RelMovLUser, Reset,
ResetElapsedTime, RJ, Rotation, RP, ScrewCommitErrInfo,
ScrewCommitInfo, ScrewCommitProductInfo, ScrewDriverGetError,
ScrewDriverGetResult, ScrewGetSelectedSN, ScrewSetCurrentSN,
SendCam, ServoJ, ServoP, SetABZPPC, SetBackDistance,
SetCnvPointOffset, SetCnvTimeCompensation, SetCoils, SetCollisionLevel,
SetDOMode, setExcitMode, SetExicitCmd, SetExicitCmdZ, SetHoldRegs,
SetObstacleAvoid, SetPartIndex, SetSafeSkin, SetStackMode,
SetTool, SetTool485, SetToolBaudRate, SetToolPower, SetUnstackMode,
SetUser, SetWeldParams, SixForceHome, Sleep, Sleep(period), Speed,
SpeedFactor, SpeedR, SpeedS, Spiral, StartCamera, StartPath,
StartTrace, StopMove, StopSyncCnv, Sync, SyncCnv, SyncExit, Systime,
TCPCreate, TCPDestroy, TCPRead, TCPReadMultiVision, TCPReadVision,
TCPSpeed, TCPSpeedEnd, TCPStart, TCPWrite, TeachPallet, ToolAI,
ToolAnalogMode, ToolDI, ToolDO, ToolDOExecute, TriggerCam,
UDPCreate, UDPRead, UDPWrite, Wait
68
8 Dobot+
The page is used to install and configure the end plug-in for controlling the end tool of the robot.
You can clicking Dobot + on the upper left of the panel to hide the panel, and restore the panel by clicking
Dobot + on the right toolbar.
Click Add Plugins to view the plug-in list. You can click Install to install the plug-in, or click Import
Plugins to upload a plug-in.
69
The plug-in will be displayed in the Dobot+ main page after installation. After selecting the corresponding
plug-in, you can configure the basic functions of the plug-in. Different plug-ins vary in their configuration
methods, which will not be described in this Guide. If you want to delete the plug-in, click x in the upper
right corner of the plug-in.
70
After installing a plug-in, the relevant blocks/commands will be added in DobotBlockly and Script module.
Now take DH gripper as an example, as shown in the figure below.
71
You can click on the right-top corner of the page to set a hotkey for the plug-in. After saving it, you
can control the end tool through the end button. For example, select DH. Set Shortcut key1 to DhOpen,
and Shortcut key2 to DhClose, and click Save. Then press the button at the end of the robot, as shown
below, and the gripper will open. Press the button again, and the gripper will close.
72
73
9 Programming
9.1 DobotBlockly
9.2 Script
74
9.1 DobotBlockly
DobotStudio Pro provides blockly programming. You can program through dragging the blocks to control
the robot.
NOTE
This document only introduces the use of blockly programming. For specific description on blocks ,
see Appendix B.
No. Description
It is used to manage project files and undo or restore programming operations. In the File
2 drop-down list, you can convert a blockly program to script. After successful conversion,
you can open the converted project in Script module
3 Control the running of the project. See Running project for details.
Provide blocks used in programming, which are divided into different colors and
4 categories. Click on the right top of the module to view the relevant description on the
blocks.
Program editing area. You can drag the blocks to the area to edit a program. Right-click the
block in the programming area to open the menu, which supports copying blocks, deleting
blocks, and turning a group of blocks into sub-routines.
5
If a block is modified but not saved, you will see on the left side of the block, which
prompts that the block has been modified.
75
Click to open Points panel. If there are unsaved changes, you will see a red dot in the
6
lower right of the icon. See Points for details.
The icons on the right side of the programming area is described below.
Icon Description
Drag the block to this icon to delete it, or long press the block and select Delete
Block to delete it.
Points
The Point interface is used to manage the points in programming, as shown below.
76
No. Description
Click to hide Points panel. You can click Points on the right toolbar to restore its display.
1
If there are unsaved changes, the icon will turn to .
3 Import a point list file or export the current point list to a file.
4 Click to fold the control panel, and click it again to unfold the panel.
77
Debugging and running project
Click Debug after saving the project, and the project will start running step by step. You can view view the
operation log in this process.
Click Start after saving the project, and the project will start running. The log of the running process
will be displayed.
Click Pause to pause running the project, and the button changes to Continue. Click Resume to
continue running the project.
78
Operation procedure
The following example describes the procedure of editing a block program to control the robot to move
between two points repeatedly.
1. Open the Points panel. Move the robot arm to a point (P1), and click Add to save the point P1.
2. Move the robot arm to a point (P2), and click Add to save the point P2.
3. Drag the forever block from the block area and place it under the Start block.
4. Drag inside the forever block, and select P1 for the target point.
5. Drag under the previous block, and select P2 for the target point.
79
6. Click Save, enter the project name and click OK.
7. Click Start, and the robot starts to move.
80
9.2 Script
Dobot robots providess various APIs, such as motion commands, TCP/UDP commands etc., which uses
Lua language for secondary development. DobotStudio Pro provides a programming environment for Lua
scripts. You can write your own Lua scripts to control the operation of robots.
NOTE
This section mainly introduces the use of script programming. For specific description on
commands, see DOBOT Lua Syntax Guide(CR).
No. Description
4 Control the running of the project. See Running project for details.
Command list.
Click on the left side of the command to view the command description.
Double-click the command to quickly add Lua command to the programming area on
5 the right
If there is a blue icon on the right side of the command, double-click the blue button
to quickly add Lua command with detailed parameters to the programming area on the
right.
81
6 Click + to add subthreads. Subthreads are parallel programs that run with the main
program. You can set I/O, variables, etc. in subthreads, but cannot call motion
commands.
Click to open Points panel. If there are unsaved changes, you will see a red dot in the
7
lower right of the icon. See Points for details.
Points
The Point interface is used to manage the points in programming, as shown below.
No. Description
Click to hide Points panel. You can click Points on the right toolbar to restore it. If there
1
are unsaved points, the icon will turn to .
3 Import a point list file or export the current point list to a file.
82
4 Click to fold the control panel, and click it again to unfold the panel.
Debugging project
Click Debug after saving the project, and the project will enter debug mode. - Clicking the line number on
the left side of the code can set a breakpoint. The program will automatically pause when it runs to the
breakpoint in debug mode. - After the program is paused at the breakpoint, you can click Continue to keep
the program running; or click Step to run the program step by step. - Click Exit Debugging to exit debug
mode.
Running project
Click Start after saving the project, and the project will start running. The log of the running process will
83
Click Start after saving the project, and the project will start running. The log of the running process will
be displayed.
Clicking Pause can pause running the project, and the button will change to Resume. Clicking
Resume will continue running the project.
Clicking Stop can stop running the project.
Operation procedure
The following example describes the procedure of editing a script program to control the robot to move
between two points repeatedly.
1. Open the Points panel. Move the robot arm to a point (P1), and click Add to save the point P1.
2. Move the robot arm to another point (P2), and click Add to save the point P2.
3. Add loop commands in the programming area.
4. Add a motion command under the loop command, and set P1 as the target point.
5. Add another motion command, and set P2 as the target point.
while(true)
do
Go(P1)
Go(P2)
end
84
6. Click Save, enter the project name and click OK.
7. Click Start, and the robot starts to move.
85
10 Process
10.1 Trajectory playback
10.2 Conveyor tracking
86
10.1 Trajectory playback
The trajectory playback is used to play back the trajectory recorded during manually dragging the robot
arm. The main interface is shown below.
Click New Trajectory on the right top corner, and the indicator light at the end of the robot turns yellow.
Now you can drag the robot. The trajectory will be recorded for playback.
After recording the trajectory, click Save path on the right top corner. Now the indicator light turns green,
and a new record named after the recording time is added in the Trajectory file list.
Click the saved trajectory, and you will see three buttons: Delete, Rename and Playback.
Click Playback to play back the recorded trajectory of the robot. In this case the indicator light at the
end of the robot flashes yellow, and the robot starts to move. After playback, the robot stops moving,
and the indicator light turns green.
Click Rename to modify the name of the trajectory file.
Click Delete to delete this trajectory.
NOTE
The saved trajectory file can be called through relevant playback commands in blockly and
script programming.
Click Advanced to set the playback mode. You can set the speed ratio of playback if you do not select
Playback at a uniform speed.
87
88
10.2 Conveyor tracking
Conveyor process is that the photoelectric sensor detects the objects on the conveyor when the conveyor is
moving, and the robot picks them up as they move.
Building Environment
The figure below shows a full process environment of conveyor tracking.
Encoder An encoder is used to record the conveyor moving distance and the workpiece position, and
report them to the robot. The encoder should be connected to the ABZ encoder interface on the controller.
It is recommended to use E6B2-CWZ1X (1000P/R) encoder. Its pin connection is shown in the table
below.
Color Port
Black A+
89
White B+
Orange Z+
Brown I/O 5V
Blue I/O 0V
Photoelectric Sensor
The photoelectric sensor outputs different level signals according to whether the workpiece is detected or
not. The control system can detect the workpiece through the signal edge. You need to connect the
photoelectric sensor to a DI interface on the controller, as shown below.
## Calibrating Conveyor Before configuring the conveyor process, you need to calibrate the conveyor for
obtaining the positional relationship between the conveyor and the robot. In the following steps, the user
coordinate system is used for calibration. Before calibration, you need to install a calibration needle at the
end of the robot, and prepare a label for calibration.
1. Paste a label on the conveyor, as shown below.
90
1. Control the conveyor to move a specified distance.
2. Jog the robot to the label position on the conveyor to obtain the second point (point B, to determine
the x-axis)
3. Jog the robot to a point not in the line determined by point A and B on the conveyor so as to obtain
the third point (point C, to determine the y-axis)
Configuring conveyor
Click Conveyor Tracking in Process page. Click Open Tool, and you will see the following page.
91
Conveyor Index: Select the index of the conveyor to be configured, multiple conveyor are supported.
Conveyor Type: Only linear type is supported (cannot be configured).
Encoder Channel: The channel is default (cannot be configured).
User Coord Index: Select the conveyor coordinate system saved in the last step.
Data Source: Only sensor is supported (cannot be configured).
Encoder
92
Calibrate the encoder resolution. The encoder resolution is the pulse increment of the encoder per unit
length that the conveyor moves.
1. Paste a label on the conveyor. Jog the robot to the label position on the conveyor, and click 1 in Pos
column to obtain the value of Position 1.
2. Control the conveyor to move a specified distance and stop it.
3. Jog the robot to the label position on the conveyor. Click 2 in Pos column to obtain the value of
Position 2.
4. Set the direction of the encoder according to the actual condition (taking Positive as an example).
5. Click Calculation to obtain the encoder resolution.
Sensor settings
93
Trigger input IO: Set the DI port index in the controller to which the sensor is connected.
Deduplication distance: After a valid signal is detected, if the signal changes within a subsequent
distance, the signal will be considered as invalid and automatically eliminated. The value can be set to
2mm ~ 5mm based on the actual condition.
Trigger type: Only rising edge trigger is supported (cannot be configured).
The sensor calibration aims to obtain the position where the sensor detects the workpiece so that the
position of the workpiece under the User coordinate system at every moment can be calculated based on
the coordinate offset when the workpiece moves along with the conveyor.
94
Setting working border
The working border is used to set the working area of the robot on the conveyor.
Work enter border: After the workpiece crosses this border, the robot arm starts to track and pick up
the workpiece.
Pick max border: When the workpiece crosses the border, If the robot arm has not started picking the
workpiece, it is regarded that it cannot finish the pickup of the workpiece, so it will not pick up the
workpiece. The border should be set based on the moving speed of the conveyor and the actual
experience. It is recommended to debug multiple times before obtaining the optimal value.
Work off border: After the workpiece crosses the border, the robot arm will stop tracking the
workpiece (to prevent the robot from tracking out of the working area), and trigger alarms.
Jog the robot to the corresponding position of each border, and click the buttons to set the values.
Click Save on the right top corner. Now you can use the conveyor configuration in the project.
Example
After configuring the parameters of the conveyor belt, you can edit a script by calling the conveyor belt
APIs to realize conveyor tracking.
95
In this example, you need to teach six points under the user coordinate system set when you configure the
conveyor belt.
Waiting point: P1
Tracking point: P2
Pickup point: P3
Lifting point: P4
Point above the placing point: P5
Placing point: P6
96
The script is as follows.
DO(9,0) -----------------------//Control the start-up and status of air pump through DO1 and D
O2
DO(2,0)
while true do
Go(P1,"Speed=100 Accel=100 SYNC=1") ---//Waiting point, generally set within the workspa
ce
print("Test")
while true do
break
end
Sleep(20)
end
97
Move(P2,"SpeedS=100 AccelS=100") ------------------//Over the pickup point
Wait(100)
--DO(2,1)
Wait(100)
Sleep(20)
Sleep(1000)
DO(2,0,"SYNC=1")
Sleep(1000)
Go(P5,"Speed=100 Accel=100")
End
98
11 Best Practice
This chapter describes the complete process of controlling a robot arm through remote I/O to help you
understand how the various functions of DobotStudio Pro are used in a coordinated manner.
Now assume the following scene: after pressing the start button, the running indicator light is on. The robot
arm grasps the material from the picking point through the end gripper, moves to the target point to release
the material, and then returns to the picking point again to grasp the material… The process is executed
repeatedly.
In order to achieve the scene above, you need to install a gripper at the end of the robot arm (taking DH
gripper as an example, please refer to DH gripper user guide for its installation), and connect the buttons
and indicators to the controller I/O interface (assuming the start button is connected to DI11 and the stop
button is connected to DI12; the running indicator is connected to DO11, and the alarm indicator is
connected to DO12. For the wiring, refer to the corresponding hardware guide of the robot).
Overall process
After installing the hardware and the powering on the robot arm, perform the software operations as
follows:
Procedure
Connecting and enabling robot
For details about connecting to the robot, refer to Connecting to Robot.
1. Search Dobot controller WiFi name and connect it. The WiFi SSID is Dobot_WIFI_XXX (XXX is
the robot index located on the base), and WiFi password is 1234567890 by default.
2. Select a robot on the top of DobotStudio Pro interface and click Connect.
99
3. Click the enabling button and set the load parameters to enable the robot.
If the installed end tool has no corresponding plug-in, skip this step and directly control the end tool
through I/O commands in subsequent programming.
1. Click Dobot+ on the right side of the main interface to open the Dobot+ panel.
2. Click Add Plugins, and then click Install of the DH plug-in to complete the installation.
100
For details about tool coordinate system, refer to Tool coordinate system. Here takes input settings as an
example.
1. Open Settings > Coordinate System > Tool Coordinate System page.
2. Add or modify a coordinate system. Enter the offset of the tool center point relative to the flange
center point, and click OK.
3. Select the tool coordinate system that you set in the last step in the control panel.
Editting project
For details on programming, refer to DobotBlockly and Script. Here takes DobotBlockly as an example.
To achieve the scene described at the beginning of this chapter, you need to teach four points, namely the
picking point P1, the transition point P2 (above the picking point), the transition point P3 (above the
uploading point), and the uploading point P4.
101
1. Open the Points page, move the robot arm to P1, and click Add.
102
2. Add P2, P3 and P4 in the same way.
3. Drag the blocks to the programming area to realize picking and unloading the material. The figure
below shows a simple program for your reference.
103
After entering the remote I/O mode, press the start button connected to the robot arm controller, and
the robot arm will start running the project.
104
Appendix A Modbus Register Definition
1 Modbus Introduction
Modbus protocol is a serial communication protocol. The robot system can communicate with external
equipment through this protocol. The external equipment, such as a PLC, is set as the Modbus master, and
the robot system is set as the slave.
Modbus-RTU: It is compact, and adopts binary representation of data, using a checksum mode of
cyclic redundancy check.
Modbus-ASCII: It adopts ASCII string representation, which is readable and redundant, using
checksum mode of longitudinal redundancy check.
Modbus-TCP: It adopts TCP connection over TCP/IP. This mode does not require checksum
calculation.
A Modbus address typically consists of five digits, including the starting datatype code, followed by the
offset address. The Modbus Master protocol library maps standard Modbus addresses to Modbus function
numbers, and reads and writes data from slave stations.
Modbus data mainly includes four types: coil status, discrete input, input register and holding registers.
Based on the robot memory space, four types of registers are defined: coil, contact (discrete input), input
and holding registers, for data interaction between the external equipment and robot system. Each register
has 4096 addresses. For details, see the description below.
105
00003 2 Bit Continue
4 Input register
Number Script
PLC Data Register
of Byte address Function
address type type
values (GetInRegs)
unsigned
31000 1 2 999 U16 Data validity
short
31002 – unsigned
3 6 1001 – 1003 U16 Reserved
31004 short
31005 –
uint64 1 8 1004 – 1007 U64 Digital input
31008
31009 –
uint64 1 8 1008 – 1011 U64 Digital output
31012
106
31013 – uint64 1 8 1012 – 1015 U64 Robot mode
31016
31017 –
uint64 1 8 1016 – 1019 U64 Timestamp
31020
31021 –
uint64 1 8 1020 – 1023 U64 Reserved
31024
Memory structure
31025 – test standard value
uint64 1 8 1024 – 1027 U64
31028 0x0123 4567 89AB
CDEF
31029 –
double 1 8 1028 – 1031 F64 Reserved
31032
31033 –
double 1 8 1032 – 1035 F64 Speed rate
31036
Control board
31041 – voltage
double 1 8 1040 – 1043 F64
31044 (Not supported by
CCBOX)
Robot voltage
31045 –
double 1 8 1044 – 1047 F64 (Not supported by
31048
CCBOX)
Robot current
31049 –
double 1 8 1048 – 1051 F64 (Not supported by
31052
CCBOX)
31053 –
double 1 8 1052 – 1055 F64 Reserved
31056
31057 –
double 1 8 1056 – 1059 F64 Reserved
31060
31061 –
double 3 24 1060 – 1071 F64 Reserved
31072
31073 –
double 3 24 1072 – 1083 F64 Reserved
31084
31085 –
double 3 24 1084 – 1095 F64 Reserved
31096
31121 –
double 6 48 1120 – 1143 F64 Target joint speed
31144
107
31192 double 6 48 1168 – 1191 F64 Target joint current
31193 –
double 6 48 1192 – 1215 F64 Target joint torque
31216
31241 –
double 6 48 1240 – 1263 F64 Actual joint speed
31264
31265 –
double 6 48 1264 – 1287 F64 Actual joint current
31288
TCP actual
31313 –
double 6 48 1312 – 1335 F64 Cartesian
31336
coordinates
TCP force
31361 –
double 6 48 1360 – 1383 F64 (calculate through
31384
joint current)
TCP target
31384 –
double 6 48 1384 – 1407 F64 Cartesian
31408
coordinates
31433 –
double 6 48 1432 – 1455 F64 Joint temperature
31456
31456 –
double 6 48 1456 – 1479 F64 Joint control mode
31480
31481 –
double 6 48 1480 – 1503 F64 Joint voltage
31504
1506 low
31507 char 1 1 U8 User coordinates
byte
1506 high
31507 char 1 1 U8 Tool coordinates
byte
108
31509 char 1 1 1508 low U8 Joint speed rate
byte
1509 low
31510 char 1 1 U8 Joint jerk rate
byte
1512 high
31513 char 1 1 U8 Robot brake status
byte
1513 high
31514 char 1 1 U8 Robot drag status
byte
1514 low
31515 char 1 1 U8 Robot drag status
byte
1514 high
31515 char 1 1 U8 Robot alarm status
byte
1515 low
31516 char 1 1 U8 Robot jog status
byte
1515 high
31516 char 1 1 U8 Robot type
byte
Button board
1516 high enabling signal
31517 char 1 1 U8
byte (Not supported by
Nova series)
109
Button board
1517 high playback signal
31518 char 1 1 U8 (Not supported by
byte
Nova series)
Button board
gripper control
1518 low
31519 char 1 1 U8 signal
byte
(Not supported by
Nova series)
Six-dimensional
force online status
1518 high
31519 char 1 1 U8 (Six-dimensional
byte
force sensor needs
to be installed)
1519 low
31520 char 1 1 I8 Collision status
byte
(SafeSkin) arm
1519 high
31520 char 1 1 I8 close to pause
byte
status
1521 high
31522 char 1 1 I8 Reserved
byte
31523 –
- - - 1522 – 1551 - Reserved
31552
31553 –
double 1 8 1552 – 1555 F64 Reserved
31556
31557 –
uint64 1 8 1556 – 1559 U64 Reserved
31560
31561 –
double 6 48 1560 – 1583 F64 Actual torque
31584
31585 –
double 1 8 1584 – 1587 F64 Load weight (kg)
31588
X-directional
31589 –
double 1 8 1588 – 1591 F64 eccentric distance
31592
(mm)
Y-directional
31593 –
double 1 8 1592 – 1595 F64 eccentric distance
31596
(mm)
31597 – Z-directional
110
31600 (mm)
31601 –
double 6 48 1600 – 1623 F64 User coordinates
31624
31625 –
double 6 48 1624 – 1647 F64 Tool coordinates
31648
Original value of
current six-
31653 – dimentional force
double 6 48 1652 – 1675 F64
31676 (Six-dimensional
force sensor needs
to be installed)
31677 – [qw,qx,qy,qz]
double 4 32 1676 – 1691 F64
31692 target quaternion
31693 – [qw,qx,qy,qz]
double 4 32 1692 – 1707 F64
31708 actual quaternion
31709 –
double 1 24 1708 – 1720 F64 Reserved
31721
40001 –
0 – 1280 U16 Reserved for palletizing
41281
43095 –
3095 – 8999 U16 User-defined
49000
111
49004 9003 U16 (working station)
Alarm code:
0: No alarm; 1: No material in the screw machine
when taking the screws; 2: There are screws in the
49055 9054 U16
screwdriver before screw taking; 3: Screw taking
failure; 4: Abnormal screw locking; 5: The
electrical screwdriver is abnormal
112
Appendix B Blockly Commands
B.1 Quick start
B.1.1 Control robot movement
B.1.2 Read and write Modbus register data
B.1.3 Transmit data by TCP communication
B.1.4 Palletize
B.2 Block description
B.2.1 Event
B.2.2 Control
B.2.3 Operator
B.2.4 String
B.2.5 Custom
B.2.6 IO
B.2.7 Motion
B.2.8 Motion advanced configuration
B.2.9 Modbus
B.2.10 TCP
113
Quick start
114
Control robot movement
Scene description
In order to experience how to control the movement of the robot arm through blockly programming, you
can assume the following scene:
When the controller DI1 is ON, the robot moves from P1 to P2 in a linear mode, moves to P4 via P3 in a
arc mode, and then returns along the same way. When the controller DI1 is OFF, the robot arm does not
move.
1. The robot arm moves to the starting point through joint motion (P1).
115
2. Set an unconditional loop to make subsequent commands cycle while the program is running.
3. Judge whether the controller DI1 is ON. The subsequent program wil be executed only when the
controller DI1 is ON. Otherwise, it will directly enter the next loop and reacquire the status of DI1.
4. The robot arm moves to P2 in the linear mode.
5. The robot arm moves to P4 via P3 through the arc motion.
6. The robot arm moves to P2 via P3 through the arc motion (return along the same way).
7. The robot arm moves to P1 in the linear mode, and then enters the next loop (return to Step 3).
Run program
Run the program after teaching the points and programming. You can set the status of DI1 through virtual
DI in the IO panel.
116
Read and write Modbus register data
Scene description
To experience how to read and write Modbus data through blockly programming, you can assume the
following scene:
Create a Modbus master for the robot. Connect to the external slave and read the address from the specified
coil register. If the value is 1, the robot moves to P1.
1. Create the master station. Set the IP address to the slave address, and the port and ID to the default
values. In this demo the IP is set to robot address, as the robot slave is used here for quick verification.
2. Determine whether the master station is created successfully. The subsequent steps will be executed
only if the creation is successful, otherwise, the program will end directly.
3. If the value of coil register 0 of the robot has been modified, it may affect the subsequent program. So
you need to set the value of coil register 0 to 0 first.
4. Wait for the value of coil register 0 to change to 1.
5. Control the robot to move to P1, which is a user-defined point.
6. Close the master station.
Run program
117
If you need to run the program quickly, you can use the debug tool of DobotStudio Pro to modify the value
of coil register.
1. Open the debug tool and enter "Net Tool > Modbus TCP" page.
2. Move the robot to a point other than P1 (for observing whether the robot executes the motion
command). Then save and run the program.
3. After you see "Create Modbus Master Success" in the running log, select Active in the debug tool,
and modify Network Address and Port.
4. Modify Slave ID Function Code to Write Single coil, and modify Data of Resister 0 to 1. Then
click Send.
5. Observe whether the robot moves to P1.
The figure below shows the interface of the debug tool. The marked numbers correspond to the steps
above.
118
119
Transmit data by TCP communication
Scene description
To experience how to perform TCP communication through blockly programming, you can assume the
following scene:
Create a TCP server for the robot. Wait for the client to connect to the server and send "go" command.
Then the server returns "Go to P1" message and the robot starts to move to P1.
1. Create the TCP server (Socket 1). Set the IP (robot IP) and port (custom) .
2. Determine whether the TCP server is created successfully. The subsequent steps will be executed only
if the creation is successful, otherwise, the program will end directly.
120
3. Wait for the client to connect and send the string. Save the received string to the string variable
"tcp_recv". You need to create the string variable in advance.
4. Determine whether the received string includes "go". if it does, execute step 5 and 6. Otherwise,
execute step 7 directly.
5. Send the string "Go to P1" to the client.
6. Control the robot to move to P1, which is a user-defined point.
7. Close the TCP server.
Run program
If you need to run the program quickly, you can use the debug tool of DobotStudio Pro as the TCP client.
1. Open the debug tool and enter "Net Tool" > "TCP Client" page.
2. Move the robot to a point other than P1 (for observing whether the robot executes the motion
command). Then save and run the program.
3. After you see "Create TCP Server Success" in the running log, modify the IP address and port of the
server in DebugTools page, and click Connect.
4. After the connection is successful, enter "go" at the bottom of DebugTools page and click Send.
5. Observe whether the debug tool receives the "Go to P1" message and whether the robot moves to P1.
121
The figure below shows the interface of the debug tool. The marked numbers correspond to the steps
above.
122
Palletize
Scene description
In a case in which the materials to be carried are arranged regularly and evenly spaced, teaching the
position of each material one by one may lead to large errors and low efficiency. Palletizing process can
effectively solve such problems.
Assume that the material needs to be stacked into a cube. You need to manually palletize a target stack
type, and then teach the relevant points:
Safe point (P1): A point the robot must move to when assembling or dismantling stacks for safe
transition. It can be set to a point over the picking point.
Picking point (P2).
Preparation point and target point do not need to be taught one by one. Please refer to Configuring
stack type.
Then assume that a gripper or suction cup has been installed at the end of the robot arm, which is
controlled by controller DO1 to grip or release materials.
123
Pallet dimension
One-dimensional: The materials are arranged in a row, and the total number of materials is equal to
the number in the X direction.
Two-dimensional: The materials are arranged in a square, and the total number of materials is equal to
the product of the number in the X direction and the Y direction.
Three-dimensional: The materials are stacked into a cube, and the total number of materials is equal to
the product of the numbers in three directions.
This section takes the three-dimensional stacking as an example. Here the number of materials in each
direction is set to 10, so this demo contains 1000 materials.
Point configuration Taking the three-dimensional stack as an example, you need to configure eight points,
which correspond to the material positions on the eight corners of the cube. The control system will
automatically calculate the target point of each material through the eight points and the number of
materials, and then perform palletizing in the order of X -> Y -> Z coordinate axes.
When configuring points, you can select the points that have been taught in the project, or you can click
Custom to obtain the current point of the robot arm. The configured point icon will turn green.
124
To achieve this scene, you need to edit the program as shown in the figure below.
1. Create pallet1.
2. Create a custom number variable and set it to 1, which is used to record the repeat times.
3. Execute the subsequent commands cyclically, and set the number of times to the total number of
points corresponding to the pallet.
125
12. The repeat times is incremented by 1. Return to Step 4.
The program in this section is only a simple example. You can add more IO control and judgment
commands according to the actual condition, such as not performing subsequent actions if the material is
not picked up.
Run program
Run the program after teaching the points, configuring the stack type and programming. You can check the
status of DO1 in the IO panel.
126
Block description
127
Event
The event commands are used as a mark to start running a program.
Start command
Description: It is the mark of the main thread of a program. After creating a new project, there is a Start
block in the programming area by default. Please place other non-event blocks under the Start block to
program.
Description: It is the mark of the sub-thread of a program. The sub-thread will run synchronously with the
main thread, but the sub-thread cannot call robot control commands. It can only perform variable operation
or I/O control. Please determine whether to use the sub-thread according to the logic requirement.
128
Control
The control blocks are used to control the running path of the program.
Wait until…
Description: The program pauses running, and it continues to run if the parameter is true .
Repeat n times
Description: Embed other blocks inside the block, and the embedded block command will be executed
repeatedly for the specified times.
Repeat continuously
Description: When other blocks are embedded inside this block, the embedded commands will be
End repetition
Description: It is used to be embedded inside the execution-repeating blocks. When the program runs to
this block, it will directly end the repetition and execute the blocks after the execution-repeating block.
129
if…then…
Description: If the parameter is true, execute the embedded block. If the parameter is false, jump directly
to the next block.
Parameter: Use other hexagonal blocks which return a Boolean value (true or false) as the parameter.
if…then…else…
Description: If the parameter is true, execute the embedded blocks before "else". If the parameter is false,
execute the embedded blocks after "else".
Parameter: Use other hexagonal blocks which return a Boolean value (true or false) as the parameter.
Repeat until…
Description: Repeatedly execute the embedded block until the parameter is true.
Parameter: Use other hexagonal blocks which return a Boolean value (true or false) as the parameter.
Set label
Description: Set a label, then you can jump to the label through .
130
Parameter: Label name, which must starts with a letter, and special characters such as spaces cannot be
used.
Goto label
Description: When the program runs to the block, it will jump to the specified label directly and execute
the blocks after the label.
Fold commands
Description: Fold the embedded blocks. It has no control effect but to make the program more readable.
Pause
Description: The program pauses automatically after running to the block. It can continue to run only
through control software or remote control operations.
Description: Set collision detection. The collision detection level set through this block is valid only when
the project is running, and will restore the previous value after the project stops.
Parameter: Select the sensitivity of the collision detection. You can turn it off or select from level 1 to
level 5. The higher the level is, the more sensitive the collision detection is.
131
Description: Modify the specified user coordinate system. The modification is valid only when the project
is running, and the coordinate system will restore the previous value after the project stops.
Parameter:
Description: Modify the specified tool coordinate system. The modification is valid only when the project
is running, and the coordinate system will restore the previous value after the project stops.
Parameter:
Create pallet
Description: Create the stack type of a pallet. See Palletizing for details.
132
Parameter: :
pallet name
point index, starting from 1
Delay execution
Description: When the program runs to the block, it will pause for a specified time before it continues to
run.
Motion waiting
Description: It is used before or after a motion block to delay the delivery of motion commands or delay
the delivery of the next command after the former motion is completed.
133
Operator
The operator commands are used for calculating variables or constants.
Arithmetic command
Parameter:
Fill in both blanks with variables or constants. You can use oval blocks that return numeric values, or
directly enter the value in the blanks.
Select an operator.
Comparison command
Parameter:
Fill in both blanks with variables or constants. You can use oval blocks that return numeric values, or
directly enter values in the blanks.
Select a comparison operator.
Return: It returns true if the comparison result is true, and false if the result is false.
A and B command
Return: It returns true if the two parameters are true, and false if any one of them is false.
A or B xommand
134
Description: Perform or operation to the parameters.
Return: It returns true if any one of the parameters is true, and false if both of them are false.
Not A command
Return: It returns false if the parameter is true, and true if the parameter is false.
Get remainder
Parameter: Fill in both blanks with variables or constants. You can use oval blocks that return numeric
values, or directly fill the value in the blanks.
Round-off operation
Parameter: Fill in the blank with a variable or constant. You can use oval blocks that return numeric
values, or directly fill the value in the blank.
Monadic operation
135
Parameter:
Select an operator.
abs
floor
ceiling
sqrt
sin
cos
tan
asin
acos
atan
ln
loh
e^
10^
Fill in the blank with a variable or constant. You can use oval blocks that return numeric values, or
directly fill the value in the blank.
Description: Output the parameters to the console, which is mainly used for debugging.
Parameter:
Select Sync or Async. For Sync, it will print information after all the commands that have been
delivered are executed. For Async, it will print information immediately when the program runs to the
block.
Variables or constants to be output. You can use oval blocks, or directly fill in the blank.
136
String
The string commands include general functions of string and array.
Parameter:
Description: Determine whether the first string contains the second string.
Parameter: Two strings. You can use oval blocks which return string, or fill in directly.
Return: If the first string contains the second string, it returns true, otherwise it returns false.
Description: Connect two strings into one string. The second string will follow the first string.
Parameter: Two strings to be connected. You can use oval blocks which return string, or fill in directly.
Description: Get the length of the specified string or array. The length of a string refers to how many
characters the string has, and the length of an array refers to how many elements the array has.
137
Parameter: A string or array. You can use oval blocks that return string or array.
Parameter: Two strings to be compared. You can use oval blocks which return string, or fill in directly.
Return: It returns 0 when string 1 and string 2 are equal, -1 when string 1 is less than string 2, and 1 when
string 1 is greater than string 2.
Description: Convert the specified array to a string, and the different array elements in the string are
separated by the specified delimiter. For example, if the array is {1,2,3} and the delimiter is |, then the
converted string is "1|2|3".
Parameter:
An array to be converted to string. You can use oval blocks which return string
Delimiter used in conversion
Description: Convert the specified string to an array, using the specified delimiter to separate strings. For
example, if the array is “1|2|3” and the delimiter is |, then the converted array is {[1]=1,[2]=2,[3]=3}.
Parameter:
A string to be converted to array. You can use oval blocks which return string or fill in directly
Delimiter used in conversion
138
Description: Get the element at the specified subscript position in the specified array. The subscript
represents the position of the element in the array. For example, the subscript of 8 in the array {7,8,9} is 2.
Parameter:
Description: Get multiple elements at the specified subscript position in the specified array. Get the
element based on the step value within the range of the start and end subscripts.
Parameter:
Description: Set the value of the element at the specified position of the array.
Parameter:
139
Custom
The custom commands are used for creating and managing custom blocks, and calling global variables.
Description: Set the value of a specified variable. Please note that the block for setting global variables
and setting custom variables are the same in shape, but have slightly different functions.
Parameter:
Create variables
Click to create a variable. The variable name must start with a letter and cannot contain special characters
such as Spaces. After creating at least one variable, you will see the following variable blocks in the block
list.
Description: The newly created custom number variable (default value: nil) is recommended to be used
after assignment. You can also modify the variable name or delete the variable through the variable drop-
down list.
140
Return: variable value
Description: Set the value of a specified number variable. Please note that the block for setting global
variables and setting custom variables are the same in shape, but have slightly different functions.
Parameter:
Parameter:
Description: The newly created custom string variable (default value: nil) is recommended to be used after
assignment. You can also modify the variable name or delete the variable through the variable drop-down
list.
Parameter:
141
Select a variable to be modified.
Value after modification. You can directly fill the blank with a string.
Create array
Click to create a custom array. The array name must start with a letter and cannot contain special
characters such as Spaces. After creating at least one array, you will see the following array blocks in the
block list.
Custom array
Description: The newly created custom array is an empty array by default. It is recommended to use it
after assignment. Right-click (PC)/long-press (Android or iOS) the block in the block list to modify the
name of the array or delete the array. You can also modify the name of the currently selected array or
delete the array through the array drop-down list in other array blocks. The check box on the left side of the
array block has no use, which can be ignored.
Description: Add a variable to a specified array. The added variable will be the last item of the array.
Parameter:
Variable to be added. You can directly fill the variable in the blank, or use other oval blocks.
Select an array to be modified.
Parameter:
142
Item index. You can directly fill the index in the blank, or use other oval blocks that return numeric
values.
Parameter:
Parameter:
143
Parameter:
Select an array.
Item index. You can directly fill the index in the blank, or use other oval blocks that return numeric
values.
Create function
Click to create a new function. A function is a fixed program segment. You can define a group of blocks
that implement specific functions as a function. Every time you want to use the function, you only need to
call this function with no need to build the same block group repeatedly. A new created function needs to
be declared and defined. After the new function is created successfully, the corresponding function block
will appear in the block list.
1. Declare function
144
In this interface, you need to define the name of the function, and the type, quantity and name of the input
(parameter). The function and parameter names should not contain special characters such as spaces. You
can also add labels to functions, which can be used as comments for functions or inputs.
1. Define function
After completing the function declaration, you will see the definition header block in the programming
area.
You need to program below the header block to define the function.
You can drag out the input in the header block to use in the blocks below, indicating using the input when
actually calling the function as a parameter.
Custom function
Description: The custom function blocks, of which the name and input parameters are defined by the user,
are used to call the defined function. Right-clicking (PC)/long-pressing (App) the block in the block list
can modify the declaration of the function. If you need to delete the function, delete the definition header
block of the function.
145
Create sub-routine
Click to create a new sub-routine. Blockly programming supports embedding and calling sub-routines,
which can be blockly programming and script programming, with a maximum of two embedded levels.
After the new sub-routine is successfully created, the corresponding sub-routine block will appear in the
block list.
After selecting Block programming, you will see the sub-routine block programming page. You can
set the sub-routine description and write the subroutine.
146
After selecting Script programming, you will see the sub-routine script programming window. You
can set the sub-routine description and write the subprogram.
Sub-routine
Blockly sub-routine
Script sub-routine
Description: The sub-routine block, which is defined by the user when creating a sub-routine, is used to
call the saved sub-routine. Right-clicking (PC)/long-pressing (App) the block in the block list can modify
or delete the sub-routine.
147
IO
The IO blocks are used to manage the input and output of the IO terminals of the robot arm. The value
range of the input and output ports is determined by the corresponding number of terminals of the robot
arm. Please refer to the hardware guide of the corresponding robot arm.
Parameter:
Description: Set the on/off status of digital output port. Please use this block when setting in the sub-
thread.
Parameter:
Description: Set a group of DO. You can drag the block to the programming area and click to set it.
Parameter:
148
click + or - to increase or decrease the number of DO
Select DO port index
Select the output status (ON or OFF)
Description: Wait for the specified DI to meet the condition or wait for timeout before executing
subsequent block commands.
Parameter:
Parameter:
149
Select analog output port index.
Analog output value. You can directly enter the value in the blank, or use oval blocks that return
numeric values.
Description: Determine whether the current status of the specified DI meets the condition.
Parameter:
Return: If the current status of the specified DI meets the condition, it returns true, otherwise, it returns
false.
Parameter:
150
Motion commands
The motion commands are used to control the movement of the robot arm and set motion-related
parameters.
The motion blocks are all asynchronous commands, that is, after the command is successfully delivered,
the next command will be executed without waiting for the robot to complete the current movement. You
can use sync command if you need to wait for the delivered commands to be executed before executing
subsequent commands.
The point parameters can be selected here after being added on the "Point" page of the project. The motion
blocks also support dragging out the default variable block and replacing it with other oval blocks which
return Cartesian point coordinates.
Advanced configuration
When the preset motion block cannot meet the programming requirements, you can create a block that
controls the robot motion through advanced configuration. The created block will appear in the
programming area. For details, refer to Motion advanced configuration.
Description: Control the robot to move from the current position to the target point. After dragging the
blocks to the programming area, double-click to perform advanced configuration. See Motion advanced
configuration for details.
Parameter:
Select a motion mode, including joint motion (MovJ) and linear motion (MovL). For joint motion, the
trajectory is non-linear, and all joints complete the motion simultaneously.
target point
151
Description: Control the robot to move from the current position to a target point after offset. You can set
the current point as the target point.
Parameter:
Select a motion mode, including relative joint motion (RelMovJ) and relative linear motion
(RelMovL).
target point
offset in the X-axis, Y-axis, and Z-axis direction relative to the target point under the Cartesian
coordinate system. unit: mm
Description: Control the robot to move a specified offset from the current position.
Arc motion
Description: Control the robot to move from the current position to a target position in an arc interpolated
mode under Cartesian coordinate system. The coordinates of the current position should not be on the
straight line determined by the intermediate point and the end point.
Parameter:
Circle motion
Description: Control the robot arm to move from the current position in an full-circle interpolated mode,
and return to the current position after moving a specified number of circles. The coordinates of the current
position should not be on the straight line determined by the intermediate point and the end point.
Parameter:
152
Enter the number of circles for circle movement. Value range: 1~ 999.
Trajectory playback
Description: Control the robot to play back the trajectory. The trajectory should be recorded in Trajectory
playback process.
Parameter:
Sync command
Description: When the program runs to this command, it will wait for the robotic arm to execute all the
commands that have been delivered before, and then continue to execute subsequent commands.
Set CP ratio
Description: Set the continuous path ratio in motion, that is, when the robot moves from the starting point
to the end point via the intermediate point, whether it passes the intermediate point through right angle or
in curve, as shown below.
153
Parameter: Continuous path ratio. Value range: 0~100.
Parameter: joint speed ratio, range: 0~100. Actual robot speed = percentage set in blocks × speed in
playback settings × global speed ratio.
Parameter: joint acceleration ratio, range: 0~100. Actual robot acceleration = percentage set in blocks ×
acceleration in playback settings × global speed ratio.
Parameter:
154
Linear and arc speed ratio (value range: 0~100). Actual robot speed = percentage set in blocks ×
speed in playback settings × global speed ratio.
Parameter:
Linear and arc acceleration ratio (value range: 0~100). Actual robot acceleration = set ratio × value in
playback settings in software × global speed ratio.
Modify coordinates
Description: Modify the value of the specified point in the specified Cartesian coordinate axis.
Parameter:
Select a point.
Select a coordinate axis.
Set coordinate value.
Get coordinates
Description: Get the value of the specified point in the specified Cartesian coordinate axis.
Parameter:
155
Select the coordinate dimension.
Description: Get the value of the TCP current position in the specified coordinate axis under the specified
coordinate system.
Parameter:
Return: Value of the TCP current position in the specified coordinate axis under the specified coordinate
system.
156
Motion advanced configuration
Create a block that controls the movement of the robot through advanced configuration. The configuration
includes the block name, motion mode and motion parameters. Different motion modes vary in the motion
parameters to be configured.
MovJ
Motion mode: Move from the current position to the target position under the Cartesian coordinate system
in a joint-interpolated mode.
157
Basic setting:
P: target point, which can be selected here after being added in the Point page, or defined in this page.
Advanced setting:
158
MovL
Motion mode: Move from the current position to the target position under the Cartesian coordinate system
in a linear interpolated mode.
Basic setting: P: target point, which can be selected here after being added in the Point page, or defined in
this page.
159
Advanced setting:
JointMovJ
160
Motion mode: Move from the current position to the target joint angle in a joint-interpolated mode.
Basic setting: target joint angle, which can be defined through teaching.
Advanced setting:
RelMovJ
161
Motion mode: Move from the current position to the target offset position under the Cartesian coordinate
system in a joint-interpolated mode.
Basic setting: X-axis, Y-axis and Z-axis offset under the Cartesian coordinate system, unit: mm
Advanced setting:
for details.
RelMovL
Motion mode: Move from the current position to the target offset position under the Cartesian coordinate
system in a linear interpolated mode.
162
Basic setting: X-axis, Y-axis and Z-axis offset under the Cartesian coordinate system, unit: mm
Advanced setting:
Arc
Motion mode: Move from the current position to the target position in an arc interpolated mode under the
Cartesian coordinate system. The current position should not be on a straight line determined by point A
and point B.
163
Basic setting:
Advanced setting:
Circle
Motion mode: Move from the current position in a circle interpolated mode, and return to the current
position after moving specified circles. The current position should not be on a straight line determined by
point A and point B, and the circle determined by the three points cannot exceed the movement range of
the robot arm.
164
Basic setting:
Intermediate point A coordinate: It is used to determine the intermediate point coordinates of the
circle.
End point B coordinate: It is used to determine the end point coordinates of the circle. The two points
can be selected here after being added in the Points page, or defined in this page.
Number of circles: circles of Circle motion, range: 1~999.
Advanced setting:
165
The continuous path (CP) means when the robot arm moves from the starting point to the end point via the
middle point, whether it transitions at a right angle or in a curved way when passing through the middle
point, as shown below.
166
Modbus commands
The Modbus commands are used for operations related to Modbus communication.
Description: Create Modbus master, and establish the connection with slave.
Parameter:
Return:
Description: Wait for the value of the specified address of input register to meet the condition before
executing the next command.
Parameter:
167
Data type
U16: 16-bit unsigned integer (two bytes, occupy one register)
U32: 32-bit unsigned integer (four bytes, occupy two registers)
F32: 32-bit single-precision float number (four bytes, occupy two registers)
F64: 64-bit double-precision float number (eight bytes, occupy four registers).
condition that the value is required to meet
Description: Wait for the value of the specified address of holding register to meet the condition before
executing the next command.
Parameter:
Description: Wait for the value of the specified address of discrete input register to meet the condition
before executing the next command.
Parameter:
Address: Starting address of the discrete input registers. Value range: 0~9999.
condition that the value is required to meet
Description: Wait for the value of the specified address of input register to meet the condition before
executing the next command.
168
Parameter:
Parameter:
Parameter:
Description: Get the value of the specified address of discrete input register.
Parameter: Starting address of the discrete input register. Value range: 0~9999.
169
Return: discrete input value
Parameter:
Return: coil register values stored in table. The first value in table corresponds to the value of coil register
at the starting address.
Parameter:
170
series) or 30 values (Nova series) are read continuously when communicating with the slave via
the tool I/O interface, and up to 62 values are read continuously for the other scenarios.
F64: 64-bit double-precision float number (eight bytes, occupy four registers). Up to 3 values
(CR series) or 15 values (Nova series) are read continuously when communicating with the slave
via the tool I/O interface, and up to 31 values are read continuously for the other scenarios.
Return: holding register values stored in table. The first value in table corresponds to the value of holding
register at the starting address.
Parameter:
Parameter:
Parameter:
171
Data type
U16: 16-bit unsigned integer (two bytes, occupy one register). Up to 27 values are written
continuously when communicating with the slave via the tool I/O interface, and up to 123 values
are written continuously for the other scenarios.
U32: 32-bit unsigned integer (four bytes, occupy two registers). Up to 13 values are written
continuously when communicating with the slave via the tool I/O interface, and up to 61 values
are written continuously for the other scenarios.
F32: 32-bit single-precision float number (four bytes, occupy two registers). Up to 13 values are
written continuously when communicating with the slave via the tool I/O interface, and up to 61
values are written continuously for the other scenarios.
F64: 64-bit double-precision float number (eight bytes, occupy four registers). Up to 6 values are
written continuously when communicating with the slave via the tool I/O interface, and up to 30
values are written continuously for the other scenarios.
Description: Close the Modbus master, and disconnect from all slaves.
172
TCP commands
The TCP commands are used for operations related to TCP.
Connect SOCKET
Description: Create a TCP server to communicate with the specified TCP server.
Parameter:
Select the SOCKET index (4 TCP communication links at most can be established).
IP address of TCP server.
TCP server port.
Create SOCKET
Description: Create a TCP server to wait for connection from the client.
Parameter:
22, 23, 502 (0~1024 ports are linux-defined ports, which has a high possibility of being occupied.
Please avoid to use),
5000~5004, 6000, 8080, 11000, 11740, 22000, 22002, 29999, 30003, 30004, 60000, 65500~65515
173
Get result of creating SOCKET
Close SOCKET
Get variables
Parameter:
Socket index
variable type: string or number.
Name is used for saving received variables, using created variable blocks
Waiting time: if the waiting time is 0, it will wait until it gets variables.
Send variables
Parameter:
Socket index.
data to be sent. You can use oval blocks that return string or numeric values, or directly fill in the
blank.
Return: It returns 0 if the variable is sent, and 1 if the variable failed to be sent
175
Appendix C Script Commands
C.1 Lua basic grammar
C.2 Command description
176
Lua basic grammar
177
Variable and data type
If you want to learn related knowledge of Lua programming systematically, please search for Lua
tutorials on the Internet. This guide only lists some of the basic Lua syntax for your quick reference.
Variables are used to store values, pass values as parameters or return values as results. Variables are
assigned with "=".
Variables in Lua are global variables by default unless explicitly declared as local variables using "local".
The scope of local variables is from the declaration location to the end of the block in which they are
located.
a = 5 -- global variable
local b = 5 -- local variable
Variable names can be a string made up of letters, underscores and numbers, which cannot start with a
number. The keywords reserved by Lua cannot be used as a variable name.
For Lua variables, you do not need to define their types. After you assign a value to the variable, Lua will
automatically judge the type of the variable according to the value.
Lua supports a variety of data types, including number, boolean, string and table. The array in Lua is a type
of table.
There is also a special data type in Lua: nil, which means void (without any valid values). For example, if
you print an unassigned variable, it will output a nil value.
Number
The number in Lua is a double precision floating-point number and supports various operations. The
following format are all regarded as a number:
2
2.2
0.2
2e+1
0.2e-1
7.8263692594256e-06
Boolean
The boolean type has only two optional values: true and false. Lua treats false and nil as false, and others
as true including number 0.
String
178
A string can be made up of digits, letters, and/or underscores. Strings can be represented in three ways:
When performing arithmetic operations on a string of numbers, Lua attempts to convert the string of
numbers into a number.
Function Description
Example:
179
str = "Lua"
print(string.upper(str)) --Convert to uppercase letters, and print the result: LUA
print(string.lower(str)) --Convert to lowercase letters, and print the result: lua
print(string.reverse(str)) --The string is reversed, and print the result: aul
print(string.len("abc")) --Calculate the length of the string ABC, and print the result:
3
print(string.format("the value is: %d",4)) --Print the result: the value is:4
print(string.rep(str,2)) --Copy the string twice and print the result: LuaLua
string1 = "cn."
string2 = "dobot"
string3 = ".cc"
print("Address: ",string1..string2..string3) --Use .. to connect strings,and print the resu
lt: Address: cn.dobot.cc
string1 = [[aaaa]]
print(string.gsub(string1,"a","z",3)) --Replace in a string and print the result: zzza
print(string.find("Hello Lua user", "Lua", 1)) --Search for Lua in the string and return th
e starting and ending index of the substring, printing the result: 7,9
sourcestr = "prefix--runoobgoogletaobao--suffix"
sub = string.sub(sourcestr, 1, 8) --Get the first through eighth characters of t
he string
print("\n result", string.format("%q", sub)) --Print: result: "prefix--"
Table
The simplest way to create a table is to use {}, which creates an empty table. This method initializes
the table directly.
A table can use associative arrays. The index of an array can be any type of data, but the value cannot
be nil.
The size of a table is not fixed and can be expanded as required.
The symbol "#" can be used to obtain the length of a table.
Function Description
table.concat
(table [, sep [, The table.concat () function lists all elements of the specified array from start to
start [, end, separated by the specified separator (sep)
end]]])
table.insert
180
(table, [pos,] optional parameter, which defaults to the end of the table.
value)
Return the element in the table at the specified position (pos), the element that
table.remove
follows will be moved forward. pos is an optional parameter and defaults to the
(table [, pos])
table length, which is deleted from the last element.
table.sort
(table [, The elements in the table are sorted in ascending order.
comp])
Example 1:
print("The last element is",fruits[5]) --print the result: The last element is mango
table.remove(fruits)
print("The last element after removal is",fruits[5]) --print the result: The last element
after removal is nil
Example 2:
fruits = "banana","orange","apple","grapes"}
print("Before")
for k,v in ipairs(fruits) do
print(k,v) --print the result: banana orange apple grapes
end
--In ascending order
table.sort(fruits)
print("After")
for k,v in ipairs(fruits) do
print(k,v) --print the result: apple banana grapes orange
end
Array
181
An array is a collection of elements of the same data type arranged in a certain order. It can be one-
dimensional or multidimensional. The index of an array can be represented as an integer, and the size of
the array is not fixed.
One-dimensional array: The simplest array with a logical structure of a linear table.
Multidimensional array: An array contains an array or the index of a one-dimensional array
corresponds to an array.
Example 1: One-dimensional array can be assigned or read through the for loop command. An integer
index is used to access an array element. If the index has no value then the array returns nil.
In Lua, array indexes start at 1 or 0. Alternatively, you can use a negative number as an index of an array.
array = {}
for i= -2, 2 do
array[i] = i*2+1 --Assign values to a one-dimensional array
end
for i = -2,2 do
print(array[i]) --Print the result:-3 -1 1 3 5
end
-- initialize an array
array = {}
for i=1,3 do
array[i] = {}
for j=1,3 do
array[i][j] = i*j
end
end
-- Access an array
for i=1,3 do
for j=1,3 do
print(array[i][j]) --Print the result:1 2 3 2 4 6 3 6 9
end
end
182
Operator
Arithmetic Operator
Command Description
+ Addition
- Subtraction
* Multiplication
// Floor division
% Remainder
^ Exponentiation
\ OR operator
~ XOR operator
Example
a=20
b=5
print(a+b) --Print the results for a plus b: 25
print(a-b) --Print the result of a minus b: 15
print(a*b) --Print the result of a times b: 100
print(a/b) --Print the result of a divided by b: 4
print(a//b) --Print the result of a divisible by b: 4
print(a%b) --Print the remainder of a divided by b: 0
print(a^b) --Print the results for the b-power of a: 3200000
print(a&b) --Print the results of a And b: 4
print(a|b) --Print the results of a OR b: 21
print(a~b) --Print the results of a XOR b: 17
print(a<<b) --Print the result of a shift left b: 640
print(a>>b) --Print the result of a shift right b: 0
Relational Operator
Command Description
== Equal
183
~= Not equal
Example
Logical Operator
Command Description
Logical AND operator, the result is true if both sides are true, and false if either side
and
is false
or Logical OR operator, the result is true if one side is true, or false if either side is false
not Logical NOT operator, that is, the judgment result is directly negative
Example
a=true
b=false
print(a and b) --True and false, the result is false
print(a or b) --True or false, the result is true
print(20 > 5 not true) --True and untrue, the result is false
184
Process control
Command Description
if…then…
Conditional command (if). Determine whether the conditions are valid from top to
elseif…
bottom. If a condition judgment is true, the corresponding code block is executed, and
then…
the subsequent condition judgments are directly ignored and no longer executed
else…end
Loop command (while). When the condition is true, make the program execute the
while…
corresponding code block repeatedly. The condition is checked for true before the
do…end
statement is executed
for…do… Loop command (for), execute the specified statement repeatedly, and the number of
end repetitions can be controlled in the for statement
repeat…
Loop command (repeat), the loop repeats until the specified condition is true
until()
Example
a = 100;
b = 200;
--[ Check conditions --]
if(a == 100)
then
--[Execute the following code if the condition is true--]
if(b == 200)
then
--[Execute the following code if the condition is true--]
print("This is a: ", a );
print("This is b: ", b );
end
end
a=10
while( a < 20 )
do
print("This is a: ", a)
a = a+1
end
for i=10,1,-1 do
185
print(i)
end
a = 10
repeat
print("This is a: ", a)
a = a + 1
until(a > 15)
186
Command description
187
General description
Motion mode
The motion modes of the robot include the following types.
Joint motion
The robot arm plans the motion of each joint according to the difference between the current joint angle
and the joint angle of the target point, so that each joint completes the motion at the same time. The joint
motion does not constrain the trajectory of TCP (Tool Center Point), which is generally not a straight line.
As the joint motion is not limited by the singularity position (see the corresponding hardware guide for
details), if there is no requirement for the motion trajectory, or the target point is near the singularity
position, it is recommended to use joint motion.
Linear motion
The robot arm plans the motion trajectory according to the current posture and the posture of the target
point, so that the TCP motion trajectory is a straight line, and the posture of the end changes uniformly
during the movement.
When the trajectory may pass through the singularity position, an error will be reported when the linear
motion command is delivered to the robot arm. It is recommended to re-plan the point or use joint motion
near the singularity position.
Arc motion
The robot arm determines an arc or a circle through three non-collinear points: the current position, P1 and
P2. The posture of the end of the robot arm during the movement is calculated by the posture interpolation
of the current point and P2, and the posture of P1 is not included in the operation (i.e, the posture of the
robot arm when it reaches P1 during the movement may be different from the taught posture).
188
When the trajectory may pass through the singularity position, an error will be reported when the arc
motion command is delivered to the robot arm. It is recommended to re-plan the point or use joint motion
near the singularity position.
Point parameters
The point parameters in the commands generally use the taught point in the Points page, and it can be
called directly using the name of taught point. The taught point is actually saved as a constant in the
background in the following format.
--[[
name: name of taught point
joint: joint coordinates of taught point
tool: tool coordinate system index in hand guiding
user: user coordinate system index in hand guiding
pose: posture variable value of taught point
--]]
{
name = "name",
joint = {j1, j2, j3, j4, j5, j6},
tool = index,
user = index,
pose = {x, y, z, rx, ry, rz}
}
In addition to the taught point, users can also define the Cartesian coordinate points or joint coordinate
points as the point parameters, see the parameter description of each command for details.
189
Speed parameters
The Speed/SpeedS and Accel/AccelS in the optional parameters are used to specify the speed and
acceleration rate when the robot arm executes the motion command.
The maximum acceleration/velocity is limited by Playback Setting, which can be viewed and modified in
"Motion parameter" page in the software.
The global speed rate can be set through the control software (upper right corner of the figure above) or the
SpeedFactor command.
The command rate is carried by the optional parameters of the motion commands. When the
acceleration/velocity rate is not specified through the optional parameters, the value set in the motion
parameters is used by default (see Speed, Accel, SpeedS, AccelS, SpeedR, AccelR commands for details,
and the default value is 50 when the command setting is not called).
Example:
Go(P1) -- Move to P1 at the acceleration of (maximum joint acceleration x 20% x 50%) and speed
of (maximum joint speed x 20% x 60%) through the joint motion
Go(P1,"Speed = 40, Accel = 90") -- Move to P1 at the acceleration of (maximum joint accelerati
190
on x 20% x 30%) and speed of (maximum joint speed x 20% x 80%) through the joint motion
Queue command is not executed immediately after it is issued, but enters the background algorithmic
queue and wait to be executed.
The background algorithm queue will not block the thread. If the immediate command is called after the
queue command, the immediate command may be executed before the queue command is completed, such
as the following example:
In this example, the point that GetPose() gets is not P1, but a process point in motion.
If you want to make sure that all the previous commands have been executed when executing the
immediate command, you can call the Sync ( ) command before calling the immediate command, which
will block the program from executing until all the previous commands are fully executed, such as the
following example:
191
Motion
The motion commands is used to control the movement of the robot arm. The commands in this group are
all queue commands.
Go
Command:
Description:
Move from the current position to a target position under the Cartesian coordinate system in a point-to-
point mode. The trajectory of joint motion is not linear, and all joints complete the motion at the same time.
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate points are
supported.
Optional parameter:
User: user coordinate system index, which can be used here after being added in Settings.
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
Go(P1)
The robot moves to P1 in the point-to point mode with the default setting.
Move
Command:
192
Move(P,"User=1 Tool=2 CP=1 SpeedS=50 AccelS=20 SYNC=1 STOP=1")
Description:
Move from the current position to a target position under the Cartesian coordinate system in a linear mode.
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate points are
supported.
Optional parameter:
User: user coordinate system index, which can be used here after being added in the Settings.
Tool: tool coordinate system index, which can be used here after being added in the Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100.
AccelS: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
STOP: abort the motion. Specify the DI index. When the specified DI changes to ON during the
execution of this motion command, the robot immediately aborts the current motion and directly
executes the next command. When this parameter is set, the SYNC parameter setting is invalid and
defaults to 1.
Example:
Move(P1)
The robot arm moves to P1 in a linear mode with the default setting.
Move(P1,"STOP=3")
Move(P2)
The robot arm moves to P1 in a linear mode. When DI3 changes into ON during the motion, it stops
moving to P1 immediately and turns to move to P2 in a linear mode.
MoveJ
Command:
193
MoveJ(P,"CP=1 Speed=50 Accel=20 SYNC=1")
Description:
Move from the current position to a target joint angle in a point-to-point mode (joint motion).
Required parameter:
Optional parameter:
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
local P = {joint={0,-0.0674194,0,0,0,0}}
MoveJ(P)
Define the joint coordinate point P. Move the robot to P with the default setting.
Circle3
Command:
Description:
Move from the current position in a circle interpolated mode, and return to the current position after
moving specified circles. As the circle needs to be determined through the current position, P1 and P2, the
current position should not be on a straight line determined by P1 and P2, and the circle determined by the
three points cannot exceed the movement range of the robot arm.
Required parameter:
P1: middle point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
points are supported.
P2: end point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
194
points are supported.
Count: number of circles, range: 1 - 999.
Optional parameter:
User: user coordinate system index, which can be used here after being added in Settings.
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100
AccelS: vcceleration rate, range: 1 - 100
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
Go(P1)
Circle3(P2,P3,1)
The robot arm moves to P1, and then moves a full circle determined by P1, P2 and P3.
Arc3
Command:
Description:
Move from the current position to a target position in an arc interpolated mode under the Cartesian
coordinate system. As the arc needs to be determined through the current position, P1 and P2, the current
position should not be on a straight line determined by P1 and P2.
Required parameter:
P1: middle point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
points are supported.
P2: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
points are supported.
Optional parameter:
User: user coordinate system index, which can be used here after being added in the Settings.
Tool: tool coordinate system index, which can be used here after being added in the Settings.
195
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100
AccelS: acceleration rate, range: 1 - 100
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
Go(P1)
Arc3(P2,P3)
The robot moves to P1, and then moves to P3 via P2 in the arc interpolated mode.
GoIO
Command:
Description:
Move from the current position to a target position in a point-to-point mode (joint motion) under the
Cartesian coordinate system, and set the status of digital output port when the robot is moving.
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
points are supported.
Digital output parameters: Set the specified DO to be triggered when the robot arm moves to a
specified distance or percentage. You can set multiple groups, each of which contains the following
parameters:
Mode: trigger mode. 0: distance percentage; 1: distance value.
Distance: specified distance.
If Distance is positive, it refers to the distance away from the starting point.
If Distance is negative, it refers to the distance away from the target point.
If Mode is 0, Distance refers to the percentage of total distance. range: 0 - 100.
If Mode is 1, Distance refers to the distance value, unit: mm.
Index: DO index.
Status: DO status. 0: OFF; 1: ON.
Optional parameter:
196
User: user coordinate system index, which can be used here after being added in Settings.
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
The robot arm moves towards P1 with the default setting. When it moves 10% distance away from the
starting point, set DO2 to ON.
MoveIO
Command:
Description:
Move from the current position to a target position in a linear mode under the Cartesian coordinate system,
and set the status of digital output port when the robot is moving.
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate
points are supported.
Digital output parameters: Set the specified DO to be triggered when the robot arm moves a specified
distance or percentage. You can set multiple groups, each of which contains the following parameters:
Mode: trigger mode. 0: distance percentage; 1: distance value.
Distance: specified distance.
If Distance is positive, it refers to the distance away from the starting point.
If Distance is negative, it refers to the distance away from the target point.
If Mode is 0, Distance refers to the percentage of total distance. range: 0 - 100.
If Mode is 1, Distance refers to the distance value, unit: mm.
Index: DO index.
Status: DO status. 0: OFF; 1: ON.
197
Optional parameter:
User: user coordinate system index, which can be used here after being added in Settings.
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
The robot moves towards P1 with the default setting. When it moves 10% distance away from the starting
point, set DO2 to ON.
MoveJIO
Command:
Description:
Move from the current position to the target joint angle through joint motion, and set the status of digital
output port when the robot is moving.
Required parameter:
198
Status: DO status. 0: OFF; 1: ON.
Optional parameter:
CP: set continuous path rate in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC = 0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC = 1: synchronous execution, which means not returning after being called until the command is
executed completely.
Example:
local P = {joint={0,-0.0674194,0,0,0,0}}
MoveJIO(P, { {0, 10, 2, 1} })
The robot arm moves towards P with the default setting. When it moves to 10% distance away from the
starting point, set DO2 to ON.
ServoJ
Command:
Description:
The dynamic following command based on joint space is generally used for the stepping function of online
control to realize dynamic following by cyclic calling. The calling frequency is recommended to be set to
33 Hz, that is, the interval of cyclic calling is 30 ms.
NOTICE
This command is not affected by global speed.
When the joint angle of the target point is quite different from that of the current point, and the
motion time t is small, the joint movement speed will be too fast, which may lead to servo error
or even power outage of the robot.
Before using the command, it is recommended to carry out velocity planning for the running
points, and issue the planned points according to the fixed time interval t to ensure that the robot
can track the target points smoothly.
199
Required parameter:
Optional parameter:
t: running time of the point, unit: s, range: [0.02,3600.0], default value: 0.1.
lookahead_time: lookahead_time, similar to the D term in PID control. Scalar, no unit, range:
[20.0,100.0], default value: 50.
gain: proportional gain of target position, similar to the P term in PID control. Scalar, no unit, range:
[200.0,1000.0], default value: 500.
The lookahead_time and gain parameters jointly determine the response time and trajectory smoothness of
the robot arm. A smaller lookahead_time value or a larger gain value can make the robot arm respond
quickly, but may cause instability and jitter.
Example:
ServoP
Command:
ServoP(P)
Description:
The dynamic following command based on Cartesian space is generally used for the stepping function of
online control to realize dynamic following by cyclic calling. The calling frequency is recommended to be
set to 33 Hz, that is, the interval of cyclic calling is 30 ms.
Parameter:
Example:
ServoP({pose={-500,100,200,150,0,90} })
200
Motion parameter
The motion parameters are used to set or obtain relevant motion parameters of the robot. The commands in
this group are queue commands except GetPose, GetAngle, and SpeedFactor.
Sync
Command:
Sync()
Description:
The command is used to block the program to execute the queue commands. It returns until all the queue
commands have been executed, and then executes subsequent commands. Generally it is used to wait for
the robot arm to complete the movement.
Example:
Go(P1)
Go(P2)
Sync()
The robot arm moves to P1, and then moves to P2 before it returns to execute subsequent commands.
CP
Command:
CP(R)
Description:
Set the continuous path (CP) ratio, that is, when the robot arm moves continuously via multiple points,
whether it transitions at a right angle or in a curved way when passing through the middle point.
201
Required parameter:
Example:
CP(50)
Move(P1)
Move(P2)
Move(P3)
The robot arm moves from P1 to P3 via P2 with 50% continuous path ratio.
SpeedFactor
Command:
SpeedFactor(R)
Description:
Required parameter:
Example:
SpeedFactor(20)
Speed
Command:
202
Speed(R)
Description:
Required parameter:
Example:
Speed(20)
Go(P1)
Accel
Command:
Accel(R)
Description:
Required parameter:
Example:
Accel(50)
Go(P1)
SpeedS
Command:
SpeedS(R)
Description:
203
Set the space motion (X/Y/Z) velocity rate for linear and arc motion.
Required parameter:
Example:
SpeedS(20)
Move(P1)
AccelS
Command:
AccelS(R)
Description:
Set the space motion (X/Y/Z) acceleration rate for linear and arc motion.
Required parameter:
Example:
AccelS(50)
Move(P1)
SpeedR
Command:
SpeedR(R)
Description:
Set the pose motion (RX/RY/RZ) velocity rate for linear and arc motion.
Required parameter:
204
Example:
SpeedR(20)
Move(P1)
AccelR
Command:
AccelR(R)
Description:
Set the pose motion (RX/RY/RZ) acceleration rate for linear and arc motion.
Required parameter:
Example:
AccelR(50)
Move(P1)
GetPose
Command:
GetPose("user=0 tool=0")
Description:
Get the real-time posture of the robot arm under the Cartesian coordinate system.
Optional parameter:
user: user coordinate system index corresponding to the posture, which needs to be added in the
control software first. If not set, the global user coordinate system is used.
tool: tool coordinate system index corresponding to the posture, which needs to be added in the
control software first. If not set, the global tool coordinate system is used.
Return:
205
Cartesian coordinates of the current posture.
Example:
The robot arm moves to P1, and then returns to the current posture.
GetAngle
Command:
GetAngle()
Description:
Get the real-time posture of the robot arm under the Joint coordinate system.
Return:
Example:
The robot arm moves to P1, and then returns to the current posture.
CheckGo
Command:
CheckGo(P)
Description:
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate points are
supported.
206
Return:
Check result.
0: no error
16: End point closed to shoulder singularity point
17: End point inverse kinematics error with no solution
18: Inverse kinematics error with result out of working area
22: Arm orientation error
26: End point closed to wrist singularity point
27: End point closed to elbow singularity point
29: Speed parameter error
32: Shoulder singularity point in trajectory
33: Inverse kinematics error with no solution in trajectory
34: Inverse kinematics error with result out of working area in trajectory
35: Wrist singularity point in trajectory
36: Elbow singularity point in trajectory
37: Joint angle is changed over 180 degree
Example:
Check whether the robot arm can reach P1 through joint motion default setting. If it can, move to P1
through joint motion.
CheckMove
Command:
CheckMove(P)
Description:
Required parameter:
P: target point, which is user-defined or obtained from the Point page. Only Cartesian coordinate points are
supported.
Return:
207
Check result.
0: no error
16: End point closed to shoulder singularity point
17: End point inverse kinematics error with no solution
18: Inverse kinematics error with result out of working area
22: Arm orientation error
26: End point closed to wrist singularity point
27: End point closed to elbow singularity point
29: Speed parameter error
32: Shoulder singularity point in trajectory
33: Inverse kinematics error with no solution in trajectory
34: Inverse kinematics error with result out of working area in trajectory
35: Wrist singularity point in trajectory
36: Elbow singularity point in trajectory
37: Joint angle is changed over 180 degree
Example:
Check whether the robot arm can reach P1 through linear motion default setting. If it can, move to P1
through linear motion.
TCPSpeed
Command:
TCPSpeed(vt)
Description:
Set the absolute speed. The motion commands of Cartesian coordinate system after this command will run
at the set absolute speed, and the joint coordinate motion commands will not be affected. After setting
TCPSpeed, SpeedS no longer takes effect, but the maximum speed is still limited by the global speed
(including reduced mode).
When using the welding process package, if the command conflicts with the related commands of welding,
the welding commands will take precedence.
Required parameter:
208
vt: absolute speed, unit: mm/s, range: (0,100000]
Example:
TCPSpeed(100)
Move(P1)
The robot arm moves to P1 at an absolute speed of 100mm/s through linear motion.
TCPSpeedEnd
Command:
TCPSpeedEnd()
Description:
The command is used with TCPSpeed command for switching off absolute speed settings.
Example:
TCPSpeed(100)
Move(P1)
TCPSpeedEnd()
Move(P2)
The robot arm moves to P1 at an absolute speed of 100mm/s through linear motion, and then moves to P2
at the global speed through linear motion.
InverseSolution
Command:
InverseSolution(P,User,Tool,isJointNear,JointNear)
Description:
Inverse solution: Calculate the joint coordinates of the robot arm, based on the given coordinates in the
specified Cartesian coordinate system.
As Cartesian coordinates only define the spatial coordinates and tilt angle of the TCP, the robot arm can
reach the same posture through different gestures, which means that one posture variable can correspond to
multiple joint variables. To get a unique solution, the system requires a specified joint coordinate, and the
solution closest to this joint coordinate is selected as the inverse solution. For the setting of this joint
coordinate, see the isJointNear and JointNear parameters for details.
209
Required parameter:
Optional parameter:
isJointNear: used to set whether JointNear is effective. 0 or null: JointNear is ineffective, the
algorithm selects the joint angles according to the current angle. 1: the algorithm selects the joint
angles according to JointNear.
JointNear: joint coordinates for selecting joint angles.
Return:
Example:
InverseSolution({473.000000,-141.000000,469.000000,-180.000000,0.000,-90.000},0,0)
The Cartesian coordinates of the end of the robot arm in the user coordinate system 0 and joint coordinate
system 0 are {473,-141,469,-180,0,-90}. Calculate the joint coordinates and select the nearest solution to
the current joint angle.
InverseSolution({473.000000,-141.000000,469.000000,-180.000000,0.000,-90.000},0,0,1,{0,0,-90,0,
90,0})
The Cartesian coordinates of the end of the robot arm in the user coordinate system 0 and joint coordinate
system 0 are {473,-141,469,-180,0,-90}. Calculate the joint coordinates and select the nearest solution to
{0,0,-90,0,90,0}.
SetBackDistance
Command:
SetBackDistance(distance)
Description:
Set the backoff distance after the robot detects collision. The value set through this command only takes
effect when the current project is running, and will restore to the original value after the project stops.
Required parameter:
210
distance: collision backoff distance, range: [0,50], unit: mm.
Example:
SetBackDistance(20)
211
Relative motion
The motion commands is used to control the movement of the robot arm. The commands in this group are
queue commands except for RP and RJ.
RP
Command:
Description:
Set the X-axis, Y-axis, Z-axis offset of a point under the Cartesian coordinate system to return a new
Cartesian coordinate point.
Required parameter:
P1: Point before offset, which is user-defined or obtained from the TeachPoint page. Only Cartesian
coordinate points are supported
OffsetX, OffsetY, OffsetZ: X-axis, Y-axis, Z-axis offset in the Cartesian coordinate system; unit: mm
Return:
Example:
Go(RP(P1, {30,50,10}))
Displace P1 by a certain distance on the X, Y, and Z axes respectively, and then move to the point after the
offset.
RJ
Command:
Description:
Set the angle offset of J1~J6 axes of a specified point under the Joint coordinate system, and return a new
joint coordinate point.
212
Required parameter:
P1: Point before offset, which cannot be obtained from the TeachPoint page. Only Cartesian
coordinate points are supported.
Offset1~Offset6: J1~J6 axes offset. unit: °.
Return:
Example:
MoveJ(RJ(P1, {60,50,32,30,25,30}))
Set the angle offset of J1~J6 axes, and move the robot arm to the target point after offset.
GoToolR
Command:
GoToolR({x, y, z, rx, ry, rz}, Tool, "User=0 CP=1 Speed=50 Accel=20 SYNC=1")
Description:
Move from the current position to the target position relatively through joint motion. The trajectory of joint
motion is not linear, and all joints complete the motion at the same time.
Required parameter:
{x, y, z, rx, ry, rz}: offset of the target point relative to the current position in the specified tool
coordinate system. x, y, z represent the spatial offset, unit: mm; rx, ry, rz represent the angular offset,
unit: °.
Tool: tool coordinate system index, which can be used here after being added in Settings.
Optional parameter:
User: user coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called, regardless
of the execution process.
SYNC = 1: synchronous execution. which means not returning after being called until the command is
executed completely.
Example:
213
GoToolR({10, 10, 10, 0, 0, 0},0)
The robot arm moves to the specific offset point along the tool coordinate system 0 through joint motion
with the default settings.
MoveToolR
Command:
MoveToolR({x, y, z, rx, ry, rz}, Tool, "User=0 CP=1 SpeedS=50 AccelS=20 SYNC=1")
Description:
Move from the current position to the target position relatively through linear motion.
Required parameter:
{x, y, z, rx, ry, rz}: offset of the target point relative to the current position in the specified tool
coordinate system. x, y, z represent the spatial offset, unit: mm; rx, ry, rz represent the angular offset,
unit: °.
Tool: tool coordinate system index, which can be used here after being added in Settings.
Optional parameter:
User: user coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100.
AccelS: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called, regardless
of the execution process.
SYNC = 1: synchronous execution. which means not returning after being called until the command is
executed completely.
Example:
The robot arm moves to the specific offset point along the tool coordinate system 0 through linear motion
with the default settings.
GoUserR
Command:
214
GoUserR({x, y, z, rx, ry, rz}, User, "Tool=0 CP=1 Speed=50 Accel=20 SYNC=1")
Description:
Move from the current position to the target position relatively through joint motion. The trajectory of joint
motion is not linear, and all joints complete the motion at the same time.
Required parameter:
{x, y, z, rx, ry, rz}: offset of the target point relative to the current position in the specified user
coordinate system. x, y, z represent the spatial offset, unit: mm; rx, ry, rz represent the angular offset,
unit: °.
User: user coordinate system index, which can be used here after being added in Settings.
Optional parameter:
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called, regardless
of the execution process.
SYNC = 1: synchronous execution. which means not returning after being called until the command is
executed completely.
Example:
The robot arm moves to the specific offset point along the user coordinate system 0 through joint motion
with the default settings.
MoveUserR
Command:
MoveUserR({x, y, z, rx, ry, rz}, User, "Tool=0 CP=1 SpeedS=50 AccelS=20 SYNC=1")
Description:
Move from the current position to the target position relatively through linear motion.
Required parameter:
{x, y, z, rx, ry, rz}: offset of the target point relative to the current position in the specified user
215
coordinate system. x, y, z represent the spatial offset, unit: mm; rx, ry, rz represent the angular offset,
unit: °.
User: user coordinate system index, which can be used here after being added in Settings.
Optional parameter:
Tool: tool coordinate system index, which can be used here after being added in Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100.
AccelS: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called, regardless
of the execution process.
SYNC: synchronous execution. which means not returning after being called until the command is
executed completely.
Example:
The robot arm moves to the specific offset point along the user coordinate system 0 through linear motion
with the default settings.
MoveJR
Command:
Description:
Move from the current position to the joint offset angle in a point-to-point mode (joint motion).
Required parameter:
{Offset1, Offset2, Offset3, Offset4, Offset5, Offset6}: J1 - J6 axes offset under the Cartesian coordinate
system, unit: °.
Optional parameter:
CP: set continuous path in motion (see CP command in Motion parameter), range: 0~100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
216
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
MoveJR({20,20,10,0,10,0})
The robot arm moves to the offset angle through joint motion with the default setting.
GoR
Command:
Description:
Move from the current position to the offset position in a point-to-point mode (joint motion) under the
Cartesian coordinate system. The trajectory of joint motion is not linear, and all joints complete the motion
at the same time.
Required parameter:
OffsetX, OffsetY, OffsetZ: X-axis, Y-axis and Z-axis offset under the Cartesian coordinate system, unit:
mm.
Optional parameter:
User: user coordinate system index, which can be used here after being added in the Settings.
Tool: tool coordinate system index, which can be used here after being added in the Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
Speed: velocity rate, range: 1 - 100.
Accel: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
GoR({10,10,10})
217
The robot arm moves to the target point in a joint-to-joint mode with the default setting.
MoveR
Command:
Description:
Move from the current position to the offset position in a linear mode under the Cartesian coordinate
system.
Required parameter:
OffsetX, OffsetY, OffsetZ: X-axis, Y-axis and Z-axis offset under the Cartesian coordinate system, unit:
mm
Optional parameter:
User: user coordinate system index, which can be used here after being added in the Settings.
Tool: tool coordinate system index, which can be used here after being added in the Settings.
CP: set continuous path in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: velocity rate, range: 1 - 100.
AccelS: acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC=0: asynchronous execution, which means returning immediately after being called,
regardless of the execution process.
SYNC=1: synchronous execution. which means not returning after being called until the
command is executed completely.
Example:
MoveR({10,10,10})
The robot arm moves to the target point through linear motion with the default setting.
218
IO
The IO commands are used to read and write system IO and set relevant parameters.
DI
Command:
DI(index)
Description:
Required parameter:
index: DI index
Return:
Example:
if (DI(1)==ON) then
Move(P1)
end
The robot arm moves to P1 through linear motion when the status of DI1 is ON.
DIGroup
Command:
DIGroup(index1,...,indexN)
Description:
Required parameter:
Return:
219
Status (ON/OFF) of corresponding DI port, returned as an array.
Example:
The robot arm moves to P1 in a linear motion when both DI1 and DI2 are ON.
WaitDI
Command:
WaitDI(index,ON|OFF,period)
Description:
Immediate command. Get the status of the digital input port. If the status is consistent with the specified
status, the program will continue to run. Otherwise, get the status of the digital input port at a specified
interval.
Required parameter:
index: DI index
ON|OFF: status of DI port. ON: high level; OFF: low level
period: period for getting DI status, unit: ms
Example:
WaitDI(1,ON,50)
Move(P1)
Get the status of DI1 every 50ms. If DI1 is high, the program continues to run, and the robot arm moves to
P1 in a linear mode.
DO
Command:
DO(index,ON|OFF)
Description:
220
Queue command. Set the status of digital output port.
Required parameter:
index: DO index
ON|OFF: status of the DO port. ON: high level; OFF: low level
Example:
DO(1,ON)
DOExecute
Command:
DOExecute(index,ON|OFF)
Description:
Immediate command. Set the status of digital output port immediately regardless of the current command
queue.
Required parameter:
index: DO index
ON|OFF: status of the DO port. ON: high level; OFF: low level
Example:
DOExecute(1,ON)
Set the status of DO1 to ON immediately regardless of the current command queue.
DOGroup
Command:
DOGroup({index1,ON|OFF},..,{indexN,ON|OFF})
Description:
Required parameter:
221
index: DO index.
ON|OFF:status of the DO port.
Multiple groups can be set, with each group wrapped in curly brackets and separated by commas.
Example:
DOGroup({1,ON},{2,ON})
ToolDO
Command:
ToolDO(index,ON|OFF)
Description:
Required parameter:
Example:
ToolDO(1,ON)
ToolDOExecute
Command:
ToolDOExecute(index,ON|OFF)
Description:
Immediate command. Set the status of tool digital output port immediately regardless of the current
command queue.
Required parameter:
222
ON|OFF: status of the DO port. ON: high level; OFF: low level
Example:
ToolDOExecute(1,ON)
Set the status of tool DO1 to ON immediately regardless of the current command queue.
ToolDI
Command:
ToolDI(index)
Description:
Required parameter:
Return:
Example:
if (ToolDI(1)==ON) then
Move(P1)
end
The robot moves to P1 in a linear mode when the status of tool DI1 is ON.
ToolAI
Command:
ToolAI(index)
Description:
Immediate command. Get the value of tool analog input port. You need to set the port to voltage-input
mode through ToolAnalogMode before using.
Required parameter:
223
index: tool AI index
Return:
Example:
test = ToolAI(1)
Get the value of tool AI1 and assign it to the variable "test".
ToolAnalogMode
Command:
ToolAnalogMode(mode)
Description:
Required parameter:
Example:
ToolAnalogMode(11)
Set the status of tool analog input port to 0 - 3.3 V voltage input mode .
AO
Command:
AO(index,value)
Description:
224
Required parameter:
index: AO index
value: voltage, range: 0 - 10
Example:
AO(1,2)
AOExecute
Command:
AOExecute(index,value)
Description:
Immediate command. Set the voltage of analog output port immediately regardless of the current command
queue.
Required parameter:
index: AO index
value: voltage, range: 0 - 10
Example:
AOExecute(1,2)
Set the voltage of AO1 to 2V immediately regardless of the current command queue.
AI
Command:
AI(index)
Description:
Required parameter:
index: AI index
225
Return:
Example:
test = AI(1)
Get the value of tool AI1 and assign it to the variable "test".
SetToolPower
Command:
SetToolPower(status)
Description:
Immediate command. Set the power status of end tool, generally used for restarting the end power, such as
repowering and reinitializing the gripper. If you need to call the interface continuously, it is recommended
to keep an interval of at least 4 ms.
Required parameter:
Example:
SetToolPower(1)
SetABZPPC
Command:
SetABZPPC(value)
Description:
Required parameter:
226
Example:
SetABZPPC(1000)
GetABZ
Command:
GetABZ()
Description:
Return:
Example:
Get the resolution of configured ABZ encoder, and assign the value to the variable "abz".
227
TCP/UDP
TCP/UDP commands are used for TCP/UDP communication. The commands in this group are all
immediate commands.
TCPCreate
Command:
Description:
Required parameter:
isServer: whether to create a server. true: create a server; false: create a client.
IP: IP address of the server, which is in the same network segment of the client without conflict. It is
the IP address of the robot arm when a server is created, and the address of the peer when a client is
created.
port: server port. When the robot serves as a server, do not use the following ports that have been
occupied by the system.
22, 23, 502 (0 - 1024 ports are linux-defined ports, which has a high possibility of being occupied.
Please avoid to use),
30005, 30006, 5000 - 5004, 6000, 8080, 11000, 11740, 22000, 22002, 29999, 30003, 30004, 60000,
65500~65515
Return:
err:
0: TCP network has been created successfully.
1: TCP network failed to be created.
socket: socket object.
Example 1:
local ip="192.168.5.1" -- Set the IP address of the robot as the IP address of the server
local port=6001 -- Server port
local err=0
local socket=0
err, socket = TCPCreate(true, ip, port)
228
Create a TCP server.
Example 2:
local ip="192.168.5.25" -- Set the IP address of external equipment such as a camera as the IP
address of the server
local port=6001 -- Server port
local err=0
local socket=0
err, socket = TCPCreate(false, ip, port)
TCPStart
Command:
TCPStart(socket, timeout)
Description:
Establish TCP connection. The robot arm waits to be connected with the client when serving as a server,
and connects the server when serving as a client.
Required parameter:
Return:
Connection result.
Example:
err = TCPStart(socket, 0)
229
TCPRead
Command:
Description:
Required parameter:
Optional parameter:
timeout: waiting timeout. unit: s. If timeout is 0, wait until the data is completely read before running;
if not, continue to run after exceeding the timeout.
type: type of return value. If type is not set, the buffer format of RecBuf is a table. If type is set to
string, the buffer format is a string.
Return:
err:
0: Data has been received successfully.
1: Data failed to be received.
Recbuf: data buffer.
Example:
Receive TCP data, and save the data as string and table format respectively.
TCPWrite
Command:
TCPWrite(socket, buf)
Description:
Required parameter:
230
socket: socket object.
buf: data sent by the robot.
Return:
Example:
TCPWrite(socket, "test")
TCPDestroy
Command:
TCPDestroy(socket)
Description:
Required parameter:
Return:
Execution result.
Example:
TCPDestroy(socket)
UDPCreate
Command:
231
UDPCreate(isServer, IP, port)
Description:
Required parameter:
isServer: false.
IP: IP address of the peer, which is in the same network segment of the client without conflict.
port: peer port.
Return:
err:
0: The UDP network has been created successfully.
1: The UDP network failed to be created.
socket: socket object.
Example:
local ip="192.168.5.25" -- Set the IP of an external device such as a camera as the IP address
of the peer
local port=6001 -- peer port
local err=0
local socket=0
err, socket = UDPCreate(false, ip, port)
UDPRead
Command:
Description:
Required parameter:
Optional parameter:
timeout: waiting timeout. unit: s. If timeout is 0, wait until the data is completely read before running;
if not, continue to run after exceeding the timeout.
232
type: type of return value. If type is not set, the buffer format of RecBuf is a table. If type is set to
string, the buffer format is a string.
Return:
err:
0: Data has been received successfully.
1: Data failed to be received.
Recbuf: data buffer.
Example:
Receive UDP data, and save the data as string and table format respectively.
UDPWrite
Command:
UDPWrite(socket, buf)
Description:
Required parameter:
Return:
Example:
UDPWrite(socket, "test")
233
Modbus
Modbus commands are used for Modbus communication. This group of commands are all immediate
commands.
ModbusCreate
Command:
ModbusCreate()
Description:
Create Modbus master station, and establish connection with the slave station.
Required parameter:
NOTICE
This parameter determines the protocol format used to transmit data after the connection is
established, and does not affect the connection result. Therefore, if you set the parameter
incorrectly when creating the master, the master can still be created successfully, but there may
be exception in the subsequent communication.
Return:
err:
0: Modbus master station has been created successfully.
1: As there are 5 created master stations, a new one failed to be created.
2: Modbus master station failed to be initialized. It is recommended to check whether the IP, port
and network is normal.
3: Modbus slave station failed to be connected. It is recommended to check whether the slave is
established properly and whether the network is normal.
id: Master station index, range: 0 - 4.
234
Example 1:
Create the Modbus master, and connect with the specified slave.
Example 2:
When none of the parameters are specified or the IP is specified to 127.0.0.1 or 0.0.0.1, it indicates
connecting to the local Modbus slave. Please refer to the following commands.
ModbusCreate()
ModbusCreate("127.0.0.1")
ModbusCreate("0.0.0.1")
Example 3:
err,id=ModbusCreate("127.0.0.1",60000,1,1)
The example 3 is a special case, indicating communication with the external Modbus RTU slave via the
485 interface at the end of the robot arm.
GetInBits
Command:
Description:
235
Required parameter:
Return:
Discrete input value stored in a table, where the first value in the table corresponds to the discrete input
value at the starting address.
Example:
inBits = GetInBits(id,0,5)
GetInRegs
Command:
Description:
Read the input register value with the specified data type from the Modbus slave.
Required parameter:
Optional parameter:
236
the tool I/O interface, and up to 62 values are read continuously for the other scenarios.
F64: 64-bit double-precision floating-point number (eight bytes, occupy four registers). Up to 3 values
(CR series) or 15 values (Nova series) are read continuously when communicating with the slave via
the tool I/O interface, and up to 31 values are read continuously for the other scenarios.
Return:
Input register values stored in a table, where the first value corresponds to the Input register value at the
starting address.
Example:
GetCoils
Command:
Description:
Required parameter:
Return:
Coil register value stored in a table, where the first value corresponds to the coil register value at the
starting address.
Example:
Coils = GetCoils(id,0,5)
GetHoldRegs
237
Command:
Description:
Read the holding register value with the specified data type from the Modbus slave.
Required parameter:
Optional parameter:
Return:
Holding register value stored in a table, where the first value corresponds to the holding register value at
the starting address.
Example:
SetCoils
Command:
238
SetCoils(id, addr, count, table)
Description:
Required parameter:
Example:
Starting from address 1024, write 5 values in succession to the coil register.
SetHoldRegs
Command:
Description:
Write the specified value according to the specified data type to the specified address of holding register.
Required parameter:
Optional parameter:
239
continuously when communicating with the slave via the tool I/O interface, and up to 123 values are
written continuously for the other scenarios.
U32: 32-bit unsigned integer (four bytes, occupy two registers). Up to 13 values are written
continuously when communicating with the slave via the tool I/O interface, and up to 61 values are
written continuously for the other scenarios.
F32: 32-bit single-precision floating-point number (four bytes, occupy two registers). Up to 13 values
are written continuously when communicating with the slave via the tool I/O interface, and up to 61
values are written continuously for the other scenarios.
F64: 64-bit double-precision floating-point number (eight bytes, occupy four registers). Up to 6 values
are written continuously when communicating with the slave via the tool I/O interface, and up to 30
values are written continuously for the other scenarios.
Example:
Starting from address 2048, write a double-precision floating-point number to the holding register.
ModbusClose
Command:
ModbusClose(id)
Description:
Optional parameter:
Return:
Example:
ModbusClose(id)
240
Program Control
The program control commands are general commands related to program control. The while, if and for
are flow control commands of lua. Please refer to Lua basic grammar - Process control.
print
Command:
print(var)
Description:
Required parameter:
Example:
Sleep
Command:
Sleep(time)
Description:
Immediate command. Delay the execution of the next command. This command is used to block the
execution of the script.
Required parameter:
time: delay time, unit: ms. Decimal points are not allowed in the parameter, which will cause the alarm or
command to be invalid, even in the form of 0.5 * 1000. Please use the integer as the parameter.
Example:
241
DO(1,ON)
Sleep(100)
DO(1,OFF)
Set DO1 to ON, wait 100ms and then set DO1 to OFF.
Wait
Command:
Wait(time)
Description:
Queue command. Deliver the motion command with a delay, or deliver the next command with a delay
after the current motion is completed. This command only blocks the execution of background algorithm
queue.
Required parameter:
time: delay time, unit: ms. Decimal points are not allowed in the parameter, which will cause the alarm or
command to be invalid, even in the form of 0.5 * 1000. Please use the integer as the parameter.
Example:
DO(1,ON)
Wait(100)
Go(P1)
Wait(100)
DO(1,OFF)
Set DO1 to ON, wait 100ms and then move the robot to P1. Delay 100ms, and then set DO1 to OFF.
Pause
Command:
Pause()
Description:
Pause running the program. The program can continue to run only through software control or remote
control.
Example:
242
Go(P1)
Pause()
Go(P2)
The robot moves to P1 and then pauses running. It can continue to move to P2 only through external
control.
SetCollisionLevel
Command:
SetCollisionLevel(level)
Description:
Queue command. Set the level of collision detection. This settings only take effect when the current project
is running. After the project stops running, the parameters restore to the original settings.
Required parameter:
level: collision detection level, range: 0 to 5. 0 means turning off collision detection. The higher the level
from 1 to 5, the more sensitive the collision detection is.
Example:
SetCollisionLevel(2)
ResetElapsedTime
Command:
ResetElapsedTime()
Description:
Queue command. Start timing after all commands before this command are executed completely. This
command should be used combined with ElapsedTime() command for calculating the operating time.
Example:
ElapsedTime
243
Command:
ElapsedTime()
Description:
Queue command. Stop timing and return the time difference. The command should be used combined with
ResetElapsedTime() command.
This interface can only count the time difference within 35 minutes. If the time difference exceeds 35
minutes, the interface will return an incorrect time difference. For longer time differences, it is
recommended to use the Systime interface for calculation.
Return:
Example:
Calculate the time for the robot arm to move back and forth 10 times between P1 and P2, and print it to the
console.
Systime
Command:
Systime()
Description:
Return:
Example:
244
local time2 = Systime()
print(time2-time1)
Get the current system time and save it to the variable "time".
SetUser
Command:
SetUser(index,table)
Description:
Queue command. Modify the specified user coordinate system. This modification only takes effect while
the current project is running. After the project is stopped, the coordinate system will be restored to the
value before modification.
Required parameter:
index: index of user coordinate system, range: 0 - 9 (0 is default user coordinate system)
table: matrix for user coordinate system, in {x, y, z, rx, ry, rz} format
Example:
SetUser(1,{10,10,10,0,0,0})
CalcUser
Command:
CalcUser(index,matrix_direction,table)
Description:
Required parameter:
index: index of user coordinate system, range: [0,9]. The initial value 0 refers to the default user
coordinate system.
matrix_direction: calculation method.
1: left multiplication, indicating that the coordinate system specified by "index" deflects the
value specified by "table" along the base coordinate system.
245
0: right multiplication, indicating that the coordinate system specified by "index" deflects the
value specified by "table" along itself.
table: offset value of user coordinate system, in {x, y, z, rx, ry, rz} format.
Return:
The user coordinate system after calculation, in {x, y, z, rx, ry, rz} format.
Example:
-- The following calculation process can be equivalent to: A coordinate system with the same i
nitial posture as User coordinate system 1, moves {x=10, y=10, z=10} along the base coordinate
system and rotates {rx=10, ry=10, rz=10}, and the new coordinate system is newUser.
newUser = CalcUser(1,1,{10,10,10,10,10,10})
-- The following calculation process can be equivalent to: A coordinate system with the same i
nitial posture as User coordinate system 1, moves {x=10, y=10, z=10} along User coordinate sys
tem 1 and rotates {rx=10, ry=10, rz=10}, and the new coordinate system is newUser.
newUser = CalcUser(1,0,{10,10,10,10,10,10})
SetTool
Command:
SetTool(index,table)
Description:
Required parameter:
index: index of tool coordinate system, range: 0 - 9 (0 is default tool coordinate system).
table: matrix for tool coordinate system, in {x, y, z, rx, ry, rz} format.
Example:
SetTool(1,{10,10,10,0,0,0})
CalcTool
Command:
CalcTool(index,matrix_direction,table)
246
Description:
Required parameter:
index: index of tool coordinate system, range: [0,9]. The initial value 0 refers to the default flange
coordinate system (TCP0).
matrix_direction: calculation method.
1: left multiplication, indicating that the coordinate system specified by "index" deflects the
value specified by "table" along the flange coordinate system (TCP0).
0: right multiplication, indicating that the coordinate system specified by "index" deflects the
value specified by "table" along itself.
table: tool coordinate system, in {x, y, z, rx, ry, rz} format.
Return:
The tool coordinate system after calculation, in {x, y, z, rx, ry, rz} format.
Example:
-- The following calculation process can be equivalent to: A coordinate system with the same i
nitial posture as Tool coordinate system 1, moves {x=10, y=10, z=10} along the flange coordina
te system (TCP0) and rotates {rx=10, ry=10, rz=10}, and the new coordinate system is newTool.
newTool = CalcTool(1,1,{10,10,10,10,10,10})
-- The following calculation process can be equivalent to: A coordinate system with the same i
nitial posture as Tool coordinate system 1, moves {x=10, y=10, z=10} along Tool coordinate sys
tem 1 and rotates {rx=10, ry=10, rz=10}, and the new coordinate system is newTool.
newTool = CalcTool(1,0,{10,10,10,10,10,10})
LoadSet
Command:
LoadSet(weight,inertia)
Description:
Queue command. Set the weight of the load. This settings only take effect when the current project is
running. After the project stops running, the parameters restore to the original settings.
Required parameter:
weight: weight of the load, the value range cannot exceed the load range of each robot model. Unit:
kg.
247
inertia: inertia of the load, unit: kgm².
Example:
LoadSet(3,0.4)
Set the weight of the load to 3 kg, and the inertia of the load to 0.4 kgm².
LoadSwitch
Command:
LoadSet(status)
Description:
Queue command. Switch on/off the load settings. Load setting is off by default, the collision detection
sensitivity can be improved after it is switched on.
Required parameter:
Example:
LoadSwitch(1)
248
Trajectory
GetTraceStartPose
Command:
GetTraceStartPose(track)
Description:
Get the first point of the trajectory for trajectory fitting (StartTrace).
Required parameter:
Return:
StartTrace
Command:
Description:
Trajectory fitting. The motion trajectory is fitted and played back based on the points recorded in the
trajectory file, and the motion speed is calculated in the same way as linear motion, which is not affected
by the motion speed at the time of trajectory recording.
Required parameter:
Optional parameter:
User: user coordinate system index, which needs to be referenced here after being added in Settings.
Tool: tool coordinate system index, which needs to be referenced here after being added in Settings.
CP: set continuous path rate in motion (see CP command in Motion parameter), range: 0 - 100.
SpeedS: motion velocity rate, range: 1 - 100.
AccelS: motion acceleration rate, range: 1 - 100.
SYNC: synchronization flag, range: 0 or 1 (default value: 0).
SYNC = 0: asynchronous execution, which means returning immediately after being called,
249
regardless of the execution process.
SYNC = 1: synchronous execution. which means not returning after being called until the command is
executed completely.
Example:
Fit and play back the trajectories recorded in the track.json file.
GetPathStartPose
Command:
GetPathStartPose(track)
Description:
Get the first point of the trajectory for trajectory playback (StartPath).
Required parameter:
Return:
StartPath
Command:
StartPath(track, "User=1 Tool=2 sample = 50 freq = 0.2 Multi=1 isConst=0 isCart=0 isRev=0 isRe
l=0")
Description:
Trajectory fitting. The motion trajectory is fitted and played back based on the points recorded in the
trajectory file, and the motion speed is calculated in the same way as linear motion, which is not affected
by the motion speed at the time of trajectory recording.
Required parameter:
250
Optional parameter:
User: user coordinate system index, which needs to be referenced here after being added in Settings.
Tool: tool coordinate system index, which needs to be referenced here after being added in Settings.
sample: the sampling interval of the trajectory points, i.e. the sampling time differences between two
adjacent points when generating the trajectory file. Range: [8, 1000], unit: ms, 50 by default (the
sample interval when the controller records the trajectory file).
freq: filter coefficient. The smaller the value of this parameter, the smoother the playback trajectory
curve is, but the more severe the distortion relative to the original trajectory. Please set the appropriate
filter coefficient according to the smoothness of the original trajectory. Range: (0,1], 1 refers to
turning off filtering, 0.2 by default.
Multi: speed multiplier in playback, range: [0.1, 2], 1 by default.
isConst: if or not to play back at a constant speed. 0 by default.
0 means the trajectory will be played back at the same speed.
1 means the trajectory will be played back at a constant speed, and the pauses and dead zones in
the trajectory will be removed.
isCart: if or not to use Cartesian points. 0 by default.
0 means the trajectory is planned using the joint points in the trajectory file.
1 means the trajectory is planned using the Cartesian points in the trajectory file. Only the joint
positions are recorded in the trajectory files recorded with DobotStudio Pro or Dobot CRStudio,
please do not set this parameter in playback.
isRev: trajectory reversal. 0 by default.
0 means the trajectory is not reversed.
1 means the trajectory is reversed, taking the ending point in the trajectory file as the starting
point and the starting point as the ending point.
isRel: trajectory offset. 0 by default.
0 means the trajectory is not offset.
1 means the trajectory is offset, taking the current point of the robot arm as the starting point of
the trajectory and offsetting the trajectory as a whole.
Example:
Play back the trajectory recorded in the track.json file at the original speed.
251
Vision
The vision module is used to configure relevant camera settings. The camera is fixed within the working
range of the robot. Its position and vision field are fixed. The camera acts as the eye of the robot and
interacts with the robot through Ethernet communication or I/O triggering.
The camera installation and configuration methods vary according to different cameras. This section will
not describe in details.
Trigger type
Trigger by IO: Connect the camera to the DO interface of the robot. You need to configure the
corresponding output port according to electrical wiring port.
Trigger by net: Connect the camera to the Ethernet port of the robot. You need to configure the strings
that the robot sends through the network to trigger the camera.
252
Basic network parameters
The basic network parameters are used to set the communication mode between the camera and the robot,
including the following modes.
TCP_Client: TCP communication. The robot serves as the client and the camera as the server. You
need to configure the IP address, port and timeout of the camera.
TCP_Server: TCP communication. The robot serves as the server and the camera as the client. You
need to configure the port and the timeout of the camera.
The receiving method includes two modes: block and non-block. Please select according to the project
script.
Block: After sending the trigger signal, the program will stay at the data-receiving line during the
block time, and the program will continue to execute until the data sent by the camera is received; If
the blocking time is set to 0, the program will wait at the data receiving line until it receives the data
sent by the camera.
Non-block: After sending the trigger signal, the program continues to execute no matter whether the
data from the camera is received or not.
The network accept format refers to the data type sent by the camera used for parse. If the current
default data bit is not enough, you can click Add data bits to increase the length of received data to a
maximum of 8 bits: No, D1, D2, D3, D4, D5, D6, STA, where No indicates the start bit template
number, and STA indicates the end bit (status bit).
InitCam
Command:
253
InitCam(CAM)
Description:
Required parameter:
CAM: Name of the camera, which should be consistent with the camera configured in the vision process
Return:
Initialization result.
0: Initialization successful
1: Failed to be initialized
Example:
InitCam(“CAM0”)
TriggerCam
Command:
TriggerCam(CAM)
Description:
Required parameter:
CAM: Name of the camera, which should be consistent with the camera configured in the vision process
Return:
Trigger result.
0: Trigger successfully
1: Fail to trigger
Example:
TriggerCam(“CAM0”)
254
Trigger the CAM0 camera to take a picture.
SendCam
Command:
SendCam(CAM,data)
Description:
Required parameter:
CAM: Name of the camera, which should be consistent with the camera configured in the vision
process
data: data sent to camera
Return:
0: Send successfully
1: Failed to send
Example:
SendCam(“CAM0”,“0,0,0,0”)
RecvCam
Command:
RecvCam(CAM,type)
Description:
Required parameter:
CAM: Name of the camera, which should be consistent with the camera configured in the vision process
Optional parameter:
255
Return:
Example:
Receive data from the CAM0 camera, and the data type is number.
DestroyCam
Command:
DestroyCam(CAM)
Description:
Required parameter:
CAM: Name of the camera, which should be consistent with the camera configured in the vision process
Return:
Example:
DestroyCam(“CAM0”)
256
Conveyor
The conveyor command must be used with the conveyor process package.
CnvVison
Command:
CnvVison(CnvID)
Description:
Required parameter:
CnvID: conveyor ID
Return
Example:
CnvVison(0)
GetCnvObject
Command:
GetCnvObject(CnvID, ObjID)
Description:
Get the data of specified object from the specified conveyor, and detects whether it enters the gripping
area.
Required parameter:
257
ObjID: object ID.
Return
flag: indicates whether the object is detected. Value range: true or false
typeObject: object type
point: object coordinate {x,y,z}
Example:
flag,typeObject,point = GetCnvObject(0,0)
SetCnvPointOffset
Command:
SetCnvPointOffset(xOffset,yOffset)
Description:
Set the offset of the points in X and Y directions under the conveyor user coordinate system.
Required parameter:
Return
Example:
SetCnvPointOffset(10,10)
SetCnvTimeCompensation
Command:
SetCnvTimeCompensation(time)
258
Description:
Set time compensation. When the gripping position of the robot arm falls behind the actual position of the
object, it can be adjusted by setting time compensation.
Required parameter:
Return
Example:
SetCnvTimeCompensation(30)
SyncCnv
Command:
SyncCnv(CnvID)
Description:
Synchronize the specified conveyor. After synchronization, points based on the conveyor user coordinate
system move with the conveyor. The motion command between this command and the StopSyncCnv
command only supports the Move command.
Required parameter:
CnvID: conveyor ID
Return
Example:
SyncCnv(0)
259
Synchronize the conveyor numbered 0.
StopSyncCnv
Command:
StopSyncCnv(CnvID)
Description:
Stop synchronizing the conveyor, and only after running this command will it continue to issue other
commands.
Required parameter:
CnvID: conveyor ID
Return
Example:
StopSyncCnv(0)
260
SafeSkin
SetSafeSkin
Command:
SetSafeSkin(status)
Description:
Required parameter:
status: 0 represents disabling SafeSkin, 1 represents enabling SafeSkin. If the Dobot+ inner SafeSkin is off,
this command does not work.
Example:
EnableSafeSkin(1)
Enable SafeSkin.
261