Dobot CRStudio User Guide (CR&Nova) V4.13.0 - V2.14.0 - 20240105 - en
Dobot CRStudio User Guide (CR&Nova) V4.13.0 - V2.14.0 - 20240105 - en
Preface
1 Getting Started
2 Connecting to Robot
3 Main Interface
3.1 Overview
3.2 Top toolbar
3.3 3D model panel
3.4 Major function panel
3.5 Jog board
4 Setting
4.1 Tool coordinate system
4.2 User coordinate system
4.3 Jog setting
4.4 Playback setting
4.5 Safety setting
4.5.1 Safe collision
4.5.2 Joint brake
4.5.3 Terminal load
4.5.4 Drag sensitivity
4.5.5 Advanced function
4.6 Remote control
4.7 Robot posture
4.8 Installation
4.9 Software setting
4.10 Manufactory
4.11 Power voltage (CCBOX)
5 Monitoring
5.1 IO monitor
5.2 Modbus
5.3 Global variable
5.4 Robot state
2
5.5 Run log
5.6 Dobot+
6 Programming
6.1 Blockly
6.2 Script
7 Process
7.1 Trajectory playback
7.2 Conveyor belt
8 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
3
C.2.2 Motion
C.2.3 Motion parameter
C.2.4 Relative motion
C.2.5 IO
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 introduces Dobot CR Studio, the mobile App of Dobot industrial robot, which is convenient
for users to understand and use CR Studio to control the industrial robot.
Intended Audience
This document is intended for:
Customer
Sales Engineer
Installation and Commissioning Engineer
Technical Support Engineer
Change History
Date Change log
5
Symbol Conventions
The symbols that may be found in this document are defined as follows.
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, robotic arm damage
6
1 Getting Started
Welcome to CR Studio. CR Studio is a mobile control software developed by Yuexijiang for industrial
robot arms. With simple functions and interface and strong practicality, CR Studio can help you quickly
master the usage of Dobot industrial robot arms.
This guide mainly describes how to use CR Studio to control the CR robot (six-axis).
If you are using CR Studio for the first time, you are recommended to read this Guide in the following
order.
1. Main Interface: It is recommended that you learn about the main interface of CR Studio first and
roughly understand the functions of CR Studio.
2. Connecting to Robot: Connect CR Studio to the robot arm and start your experience.
3. Setting: Configure the robot arm based on actual requirements. If the robot is installed in an in-ceiling
or wall-mounting mode or at a certain angle, you need to set the rotation angle and tilt angle under the
disabled state. See Installation for details.
4. Monitoring: Know about the monitoring function provided by CR Studio. If you need to install end
plug-ins, see Dobot+ for configuration.
5. Programming/Process: Know about the programming and process module of CR Studio and try
creating your own project.
6. Remote Control: After developing a project, try running the project through remote control.
7
2 Connecting to Robot
Before connecting to the robot, ensure that the WiFi module has been installed in the controller.
1.Search Dobot controller WiFi in the tablet and connect it. The WiFi name is "Dobot_WIFI_XXX" (XXX
is the robot index on the arm base), and WiFi password is 1234567890 by default.
You can modify the WiFi SSID and password in Software setting under the manager mode. The
modification takes effect after the controller is restarted.
After connecting to the controller successfully, the Connect button switches to Disconnect; and the WiFi
icon displays on the left side of the button, as shown below.
8
3 Main Interface
3.1 Overview
3.2 Top toolbar
3.3 3D model panel
3.4 Major function panel
3.5 Jog board
9
3.1 Overview
CR Studio supports operations in Android and iOS system. It is recommended to be installed in an Android
tablet or iPad. The basic functions and UI design of the two systems are almost the same. This Guide takes
Android tablet as an example to introduce the use of CR Studio.
Start the App to enter the main page, as shown below. Click , and you will see the introduction on the
main page functions.
No. Description
1 Top toolbar
2 3D model panel
4 Jog board
10
3.2 Top toolbar
The toolbar is always at the top of the screen when you use CR Studio (the tool bar can be hidden through
). The functions are listed below.
Click the icon, and the following items will pop up:
Help: View help documents
Lock: Lock the screen (Lock the App screen rather than system
screen). To unlock the screen, enter the manager password or
screen lock password
1 Menu Crash log: Upload the App crash log to help in troubleshooting
Version info: View the version information of the robot and App
About us: View the information of Yuejiang Technology Co.,
Ltd.
Exit App: Exit CR Studio App
Click to return to the main interface. When you click this button to
2 Homepage return to the main interface from other interfaces, the content that is
not saved will not lose.
Set the global speed ratio. The global speed ratio is the calculation
Global speed
4 factor of the actual running speed of the robot arm. For the
ratio
calculation method, see Jog setting and Playback setting
Abnormal use of the robot arm will trigger alarms. The icon is white
Alarm
5 when there is no alarm, and red when there is an alarm. You will see
information
the Alarm information after clicking the icon.
Click to switch the enabling status of the robot arm. See Enabling
6 Enabling button
status for details.
Monitoring
7 Click to open the IO Monitor interface. See IO monitor for details.
button
Emergency stop Press the button in an emergency, and robot arm will stop running
8
button and be powered off. See Emergency stop button for details.
Alarm information
11
You can view the alarm information in this page. Type is used to distinguish whether the alarm is sent by
the robot arm or the controller.
When there is an alarm, if the robot arm is not powered off, the end indicator light will turn red.
After resolving the error causing the alarm, click Clear Alarms to clear the alarm.
Enabling status
When the Enabling button is blue ( ), the robot arm is in the disabled status. Click the button, and
the “Tips” as well as "Change power status" window will pop up (the eccentric coordinate of the end
load should be set when the J6 axis is 0°, and the load value should not exceed the maximum
allowable load weight of the CR robot). After setting the parameters, click Confirm 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 turns green ( ).
NOTICE
Incorrect load settings may cause abnormal collision detection alarms or the robot arm to be out of
control during dragging.
12
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 the 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.
If the robot arm is powered off when connected to CR Studio, the Enabling button turns white. To
change the enabling state, you need to power on the robot first.
Once the emergency stop button is pressed, the robot arm will stop running and be powered off, and the
emergency stop icon will turn to pressed-down status ( ), as shown below.
13
If you need to enable the robot arm again, please reset the emergency stop button, clear alarms, power on
the robot and then enable it.
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).
The page will not be displayed in the remote control mode.
14
3.3 3D model panel
The 3D model panel, in the left side of the main interface, is used to display the current posture of the
robot. Pressing the right margin of the panel and dragging to the left can hide the panel.
NOTE
The panel can also be used in blockly interface, which is hidden by default. You can press on the
left margin and drag it to the right to display the panel.
Pressing and moving in the panel area and can change the vision angle for observation. You can zoom in or
zoom out through finger gestures. There are four function buttons on the top of the panel, as described
below.
: Display/Hide the movement trajectory of the robot for the last 10 seconds
15
3.4 Major function panel
The major function modules are in the center part of the main interface, through which you can access
these modules.
16
3.5 Jog board
The jog board, in the right side of the main interface, is used to control the movement of the robot. Pressing
the panel and dragging to the right can hide the board.
NOTE
The panel can also be used in other interface, which is hidden by default. You can press on the
right margin and drag it to the left to display the panel.
17
Coordinate system and step value
You can select ToolCoordinate, UserCoordinate and Step Value.
R/D/N/Cfg in the bottom of the jog board indicates the direction of each arm. Click to see specific
description.
The joint coordinate system is determined based on the moving joints. All joints are rotated joints, as
shown below.
18
User coordinate system
The user coordinate system is a user-defined coordinate system of a workbench or workpiece. Its origin
and direction of each axis can be determined according to the actual needs. The default user coordinate
system is shown below.
19
Tool coordinate system
The tool coordinate system defines the position of the tool center point (TCP) and the tool posture. Its
origin and direction constantly change with the position and angle of the end workpiece. The default tool
coordinate system is shown below.
20
4 Setting
4.1 Tool coordinate system
4.2 User coordinate system
4.3 Jog setting
4.4 Playback setting
4.5 Safety setting
4.5.1 Safe collision
4.5.2 Joint brake
4.5.3 Terminal load
4.5.4 Drag sensitivity
4.5.5 Advanced function
4.6 Remote control
4.7 Robot posture
4.8 Installation
4.9 Software setting
4.10 Manufactory
4.11 Power voltage (CCBOX)
21
4.1 Tool coordinate system
When an end effector such as welding torch 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 handle
multiple workpieces simultaneously, you can set a tool coordinate system for each gripper to improve the
efficiency.
CR Studio supports 10 tool coordinate systems. Tool coordinate system 0 is the base coordinate system
which means no tool is used and cannot be changed.
NOTE
When creating a tool coordinate system, make sure that the reference coordinate system is the base
tool coordinate system.
The six-axis tool coordinate system 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.
22
Prerequisite
Procedure
NOTE
Click on the left top side to view the instructions on the page, which is more intuitive than
the document.
If 9 coordinate systems have been added, the Add button will disappear, indicating that no more
coordinate system can be added.
2. Jog the robot to make the TCP align with the reference point (a point int the space) in the first
direction. Then click GET on the First Point panel.
23
3. Jog the robot to make the TCP align with the reference point in the second direction. Then click GET
on the Second Point panel.
4. Jog the robot to make the TCP align with the reference point in the third direction. Then click GET
on the Third Point panel.
5. Jog the robot to make the TCP align with the reference point in the vertical direction. Then click GET
on the Pose 1 panel to obtain the fourth point (point A).
6. Jog the Z-axis in the positive direction to move the robot to a point. Then click GET on the Pose 2
panel to obtain the fifth point (point B).
NOTE
7. Jog x-axis along the positive direction to move the robot to point C (not in the same line with point A
and point B). Then click GET on the Pose 3 panel to obtain the sixth point.
NOTE
This step aims to determine the positive direction of x-axis. The y-axis direction can be
determined by the right-hand rule.
8. Click Add. The tool coordinate system is created successfully, as you can see a new record in the
page.
Other operations
Clicking No. of the corresponding coordinate system (except No.0) can select the coordinate system, and
clicking other columns can modify the values of the corresponding parameters (Offset cannot be
modified).
Run to: Long press Run to to move the robot arm to the obtained point.
Cover: After obtaining the coordinates of six points, select a coordinate system and click Cover to replace
this coordinate system with the newly calibrated coordinate system.
Modify: After modifying the coordinate value of the existing coordinate system, select the coordinate
system, click Modify, and the coordinate value will be updated.
Delete: Select a coordinate system and click Delete to clear the value of the coordinate system.
NOTE
24
Delete operation means clearing the value of the record rather than deleting the record itself. You
can use Cover operation when recalibrating this coordinate system. No.0 coordinate system cannot
ne deleted.
25
4.2 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 user coordinate system on the workpiece so that all paths
synchronously update with the user coordinates, which greatly simplifies teaching and programming.
CR Studio supports 10 user coordinate systems. User 0 coordinate system is the base coordinate system
which cannot be changed.
NOTE
When creating a user coordinate system, make sure that the reference coordinate system is the base
user coordinate system.
The user coordinate system is created by three-point calibration method. Move the robot to three random
points: A, B and C. Point A is defined as the origin. 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 (In the actual calibration, point C does not have to be on the y-axis, but should fall in the
plane quadrant determined by the positive direction of the x-axis and y-axis, and should not be on the x-
axis. The system can automatically calculate the positive direction of y-axis). The z-axis can be defined
based on the right-hand rule.
Procedure
26
NOTE
Click on the left top to view the instructions on the page, which is more intuitive than the
document.
If 9 coordinate systems have been added, the Add button will disappear, indicating that no more
coordinate system can be added.
1. Jog the robot to a point (origin of the coordinate system). Click GET on the First Point panel.
2. Jog the robot to the second point on the x-axis. Click GET on the Second Point panel.
3. Jog the robot to the third point (The point should be in the plane quadrant determined by the positive
direction of the x and y axis, and should not in the x-axis.). Click GET on the Third Point panel.
4. Click Add. The user coordinate system is created successfully, as you can see a new record in the
page.
Other operations
Clicking No. of the corresponding coordinate system (except No.0) can select the coordinate system, and
clicking other columns can modify the values of the corresponding parameters.
27
Run to: Long press Run to to move the robot arm to the obtained point.
Cover: After obtaining the coordinates of three points, select a coordinate system and click Cover to
replace this coordinate system with the newly calibrated coordinate system.
Modify: After modifying the coordinate value of the existing coordinate system, select the coordinate
system, click Modify, and the coordinate value will be updated.
Delete: Select a coordinate system and click Delete to clear the value of the coordinate system.
NOTE
Delete operation means clearing the value of the record rather than deleting the record itself.
You can use Cover operation when recalibrating this coordinate system.
No.0 coordinate system cannot ne deleted.
28
4.3 Jog setting
NOTE
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.
You can set the maximum speed and acceleration in the Joint coordinate system and Cartesian coordinate
system. Click Save after setting the parameters.
Click Default to restore all the values in the corresponding module to the default values.
29
4.4 Playback setting
NOTE
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.
You can set the speed, acceleration and jerk parameters in the Joint coordinate system and Cartesian
coordinate system. Click Save after settings.
Actual robot speed/acceleration = set speed/acceleration × global speed ratio × set percentage in speed
commands when programming.
Click Default to restore all the values in the corresponding module to the default values.
30
4.5 Safety setting
31
4.5.1 Safe collision
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.
This page does not support switching on/off collision detection. If false alarms still occur frequently even
at the lowest collision level and you need to switch off collision detection, please contact technical support.
There are five collision detection levels, with Level 5 the highest. The higher level you select, the smaller
force the robot requires to stop after collision detection.
Method refers to the treatment after collision while the robot arm is running the project:
NOTICE
32
If the load is set incorrectly, it may cause the robot arm to trigger collision detection mistakenly
while moving and automatically enters the drag mode, which poses a safety risk when the robot arm
moves at a high speed.
Back-off mode: The robot arm automatically back off the specified distance according to the
trajectory before the collision. The range of the back-off distance is 0~50 (mm).
When the force required to stop is detected when you jog the robot, the "Collision Detected" 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 App 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).
33
4.5.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, 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.
34
4.5.3 Terminal load
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 properly improves the motion of robot, reduces vibration and
shortens the operating time.
NOTE
Every time you enable the CR robot, a "Change power status" window will pop up which requires
you to set the load parameters. The parameters you set will be synchronized to the "Terminal Load"
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. When the load weight is set to 0, an exclamation mark on the yellow
background will be displayed. The mark will also appear on the right bottom of the Enabling icon
after the robot is enabled.
NOTICE
Incorrect load settings may cause abnormal collision detection alarms or the robot arm to be out of
control during dragging.
35
The setting takes effect after you click Save.
Please set load and eccentric coordinates properly. Otherwise, it may cause errors or excessive shock, and
shorten the life cycle of parts.
36
4.5.4 Drag sensitivity
Drag sensitivity setting is mainly used to adjust the sensitivity of joints during dragging.
The lower the sensitivity is, the greater resistance there is during dragging.
37
4.5.5 Advanced function
NOTE
You can set in this page when you need to enable or disable advanced functions according to the site
condition.
It is recommended to remain the default settings if you do not have special requirements.
38
4.6 Remote control
External equipment can send commands to a robot (control and run the taught program file) in different
remote control modes, such as remote I/O mode and remote Modbus mode. You can set the remote mode
through App.
NOTE
You do not need to restart of 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, it cannot be switched to other working
modes. You need to stop its running before switching to other modes.
Clicking Restore can automatically switch the interface to the current working mode.
App-online
The default mode is App-online mode, in which you can use the App to control the robot.
Modbus-offline
External equipment can control the robot arm in the Modbus-offline mode.
39
The function of Modbus register is shown above. You can click to edit it.
The procedure of running the project in the Modbus-offline mode is shown below.
Prerequisite
Procedure
1. Click Modbus-Offline in the Remote Control page, and select an offline project 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.
3. Click Save. Now the robot arm has entered remote Modbus mode. Only the emergency stop command
is available. At the same time, The Debug Iog will appear at the right top of the interface. Click to
view the debug information printed during the operation of the robot arm.
4. Trigger the starting signal on the external equipment. The robot will move as the selected project file.
5. If the stop signal is triggered, the robot arm will stop moving.
40
IO-offline
External equipment can control the robot arm in the IO-Offline mode.
The specific IO interface definition of the control system is shown in the figure above. You can click
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.
41
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.
0 address: Optional projects cannot be configured.
1 address: 1 optional project can be configured.
2 addresses: 3 optional projects can be configured.
3 addresses: 7 optional projects can be configured.
4 addresses: 15 optional projects can be configured.
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 (black refers to ON, and white 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.
The procedure of running the project in the IO-offline mode is shown below.
Prerequisite
42
The external equipment has been connected to the robot arm by I/O interface.
The robot arm has been powered on.
Procedure
1. Click IO-Offline in the Remote Control page, and select an offline project for running.
2. Click Save. Now the robot arm has entered remote IO mode. Only the emergency stop command is
available. At the same time, The Debug log will appear at the right top of the interface. Click to view
the debug information printed during the operation of the robot arm.
3. Trigger the starting signal on the external equipment. The CR robot will move as the selected project
file.
4. If the stop signal is triggered, the robot arm will stop moving.
43
4.7 Robot posture
CR Studio supports moving the CR robot to common postures: package posture, home posture and custom
posture.
Moving the robot to the package posture can reduce the robot space, making it easy to pack and
transport.
The home posture refers to the home point.
The custom posture can be defined according to your requirements, which is convenient to move the
robot to the position.
Package posture: Long press Back to package posture to move the robot to the factory posture.
Home posture: Long press Back to home posture to move the robot to the home point.
Custom posture: Jog the robot to a position and click GET, and the custom posture will be saved.
Long press Back to custom posture to move the robot to the defined posture.
44
4.8 Installation
NOTE
In general, the CR robot is installed on a stable table or ground, and no operation is required in this case. If
the robot is installed in an in-ceiling or wall-mounting mode or at a certain angle, you need to set the
rotation angle and tilt angle under the disabled state.
Manual calibration
You can select a proper installation posture based on the actual condition.
Slop angle: The angle that a robot rotates counterclockwise around X-axis at the origin point.
Rotation angle: 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.9 Software setting
Screen lock setting: You can set the screen lock time of the App and change the screen lock password
as required. If you do not operate during the specified period, the screen will be automatically locked.
You can use the manager password or screen lock password to unlock the screen. The default
password is 000000.
WiFi setting: The robot can communicate with external equipment by WiFi. You can modify the WiFi
name and password on the "WiFi Setting" panel and then restart the controller to make it effective.
The default password is 1234567890.
IP setting:
The robot can communicate with external equipment by the Ethernet interface which supports TCP,
UDP and Modbus protocols. You can modify the IP address in the "IP Setting" panel. The IP address
of the CR robot must be within the same network segment as the external equipment without conflict.
If the robot is connected to external devices directly or through a switch, select Manual, and
change the IP address, subnet mask and default gateway. Then click Confirm.
If the robot is connected to external devices through a router, select Auto to automatically assign
IP address. Then click Confirm.
User manage: You can modify the user password in the "User manage" panel. The default password is
000000.
47
4.10 Manufactory
The functions in this module are generally provided by Dobot technical support or the factory. This section
will not give detailed description on the module.
48
4.11 Power 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,
minimum no less than 30V.
49
5 Monitoring
5.1 IO monitor
5.2 Modbus
5.3 Global variable
5.4 Robot state
5.5 Run log
5.6 Dobot+
50
5.1 IO monitor
51
I/O monitor has three functions: output, monitor and simulate. - Output: Set the digital output or analog
output (The analog output takes effect only when the setting is kept). Clicking Reset in Digital Output
panel can reset all modified output value. - Monitor: Monitor the status of the input and output. - Simulate:
Simulate the digital input status for debugging the program, as shown below.
When the type of control cabinet is CCBOX, you can set the digital input/output type to PNP (high level
effective) or NPN (low level effective), as shown below.
52
Clicking Edit on the right top of Digital Output or Digital Input module will zoom in on the corresponding
IO module. Take Digital Output as an example, as shown below.
53
Click Add IO Note to enter the note-setting page. Click the note box on the right side of a port, and you
can add or modify the note for this port. Click Save after setting.
Safe IO
You can set the functions of each safe I/O interface in the Safe IO page. Click Edit to modify the function,
and click Save after setting. 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 I/O (including advanced setting) cannot be configured as
safe I/O.
54
Extended IO
Besides the default tabs, you can click + to add a custom tab for monitoring the IO in Modbus
communication, as shown below.
55
slave id: Enter the device ID.
IP address: Enter the address of the Modbus device. It cannot be the same as the IP address of the
controller LAN interface (for example, the default 192.168.5.1), otherwise it may cause functional
abnormalities.
Digital Input/Digital Output: Configure the register address and number of DI/DO after selecting the
function.
After clicking CONFIRM, a new tab will appear in the IO Monitor module. The function takes effect only
after you restart the controller.
56
5.2 Modbus
This module is used to connect Modbus slave.
Click Connect to start connecting to the slave station. Click Disconnect to disconnect from the slave
station.
57
When the slave function is a coil register or a hold register, clicking a cell in the table can modify the
value and alias of the corresponding address.
When the slave function is discrete input or input register, clicking a cell in the table can modify the
alias of the corresponding address.
58
5.3 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 Blockly
programming, or call the variable through the variable name in Script programming, as shown below.
59
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.
60
EventLog, FC, FCAct, FCCalib, FCCondDisplac, FCCondDisplace,
FCCondForce, FCCondTCPSpeed, FCCondTorque, FCCondTorque,
FCDeact, FCForce, FCLine, FCLoadID, FCRefDirect, FCRefForce,
FCRefLine, FCRefRot, FCRefSpiral, FCRefTorAdjust, FCRefTorque,
FCRel, FCRot, FCSetCompliance, FCSetGain, FCSpiral, FCTorque,
GetABZ, GetAngle, GetCnvObject, GetCoils, GetHoldRegs,
GetInBits, GetInRegs, GetLayerIndex, GetPartIndex, getPathPose,
GetPathStartPose, GetPose, GetRunningData, GetTraceStartPose,
Go, GoIO, GoR, GoToolR, GoUserR, GRead, GWrite, IceCreamGO,
IceCreamP, IceCreamR, init(pix), InitCam, InverseSolution,IsDone,
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
61
5.4 Robot state
The module is used for checking the real-time status of the robot. When the type of control cabinet is
CCBOX, the average power consumption and robot current are not displayed.
NOTE
You have permission to clear the runtime data and modify the controller system time only in
manager mode.
62
63
5.5 Run log
You can view the running log to know about the operation history of the robot.
64
5.6 Dobot+
The page is used to install and configure the end plug-in for controlling the end tool of the robot.
Click Add Plugin to view the plug-in list. You can click + to install the plug-in, or click Import to upload
a plug-in.
The plug-in will be displayed in the Dobot+ main page after installation.
65
Meanwhile, relevant blocks/commands will be added in Blockly programming and Script programming.
Now take DH gripper as an example, as shown in the figure below.
Click the plug-in icon to configure the basic functions of the plug-in. Different plug-ins vary in
configuration methods. This section takes DH gripper as an example to introduce the configuration.
66
You can click Add Hotkey on the right-top 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 Hotkey1 to DhOpen, and Hotkey2 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.
67
6 Programming
6.1 Blockly
6.2 Script
68
6.1 Blockly
CR Studio 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.
Program
The Program interface is the main interface of Blockly programming, as shown below.
Project control
3 Control the project to debug (single-step running), run, pause or stop
button
Manage the project file. After clicking Open, you can open the saved
projects and realize the following functions.
Convert a blockly program to a script program, and open it in the
Project Script module after conversion.
4 management Export the selected project files to local, and import the project
button files (including the project files automatically backed up by the
69
App) from local.
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
Programming menu, which supports copying blocks, deleting blocks, and turning a
6 group of blocks (not include Event blocks) into sub-routines.
area
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.
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.
70
Point
The Point interface is used to manage the points in programming, as shown below.
Display the added points. Tool means the tool coordinate system, and
2 Point list
User means the user coordinate system.
After selecting a single point, select the Mode. Then long press Run
3 Run to function
to to move the robot to the selected point
Debug
The debug interface is used to view the script corresponding to the blocks, project operation log and 3D
model of the robot motion to confirm whether the running process and result meet your expectation, as
shown in the figure below.
71
The Main thread tab displays the script transformed from Blockly program. During the running
process, you can check the command that is running in real time.
The Variable tab displays the self-defined variables in Blockly programming.
After clicking Debug, the button turns to Step. Clicking this button can run this program step by step
( Step refers to running a single block, which may corresponds to multiple lines of script).
Click under the programming area, and the running information, including the error
information during the running and debugging process will be displayed here.
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 Point page. 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. Open the Program page. Drag the forever block from the block area and place it under the Start
block.
4. Drag inside the forever block, and select P1 as the target point.
72
5. Drag under the previous block, and select P2 as the target point.
73
6.2 Script
CR supports various APIs, such as motion commands, TCP/UDP commands etc., which uses Lua language
for secondary development. CR Studio provides a programming environment for Lua scripts. You can
write your own Lua scripts to control the operation of robots.
NOTE
This document only introduces the use of script programming. For specific description on
commands, see Appendix C.
Program
The Program interface is the main interface of Script programming, as shown below.
74
2 Function list
Project Manage the project file. After clicking Open, you can export the
3 management selected project files to local, and import the project files (including
button the project files automatically backed up by the App) from local.
Display the status of the project and control the running of the project
: Click to run the program step by step (only used in the debug
mode).
Click to lock the code area, and click it again to unlock the
area.
75
Steps for running the project automatically backed up by APP: 1. Click **Open**, and click **Import**
in the **Project List** window.
1. Select the backup project you want to import, and click Import.
2. In the "Project List" window, select the project imported in Step 2, and click Open.
3. Click Save on the Programming page, and then run the project.
Point
Point page is used to manage the points in programming, as shown below.
76
No. Item Description
Display the added points. Tool means the tool coordinate system, and
2 Point list
User means the user coordinate system.
After selecting a single point, select the Mode. Then long press Run
3 Run to function
to to move the robot to the selected point
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.
77
5. Add another motion command, and set P2 as the target point.
while(true)
do
Go(P1)
Go(P2)
end
78
7 Process
7.1 Trajectory playback
7.2 Conveyor belt
79
7.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 NewTrajectory 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.
80
Click the saved trajectory, and you will see two 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 play back relevant called commands through trajectory 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
Recurring at a uniform speed.
81
7.2 Conveyor belt
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 CR robot. The encoder should be connected to the ABZ encoder interface on the CR controller, as
shown below. The recommended encoder model is E6B2-CWZ1X (1000P/R).
Taking E6B2-CWZ1X(1000P/R)encoder as an example, the pin connection is shown in the table below.
82
Color Port
Black A+
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. 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.
83
2. Enter User coordinate system page.
3. Enable the robot. Jog the robot to the label position on the conveyor to obtain the first point (point A,
the origin of the User coordinate system).
5. Jog the robot to the label position on the conveyor to obtain the second point (point B, to determine
the x-axis).
6. Jog the robot to a point not in the line determined by point A and B on the conveyor to obtain the third
point (point C, to determine the y-axis).
84
7. Add or cover a coordinate system, and save it.
Configuring conveyor
Click Conveyor belt in Process page to start configuring the conveyor.
Basic settings
85
Encoder
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 Get
Coordinate in Position One line 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 Get Coordinate in Position One line 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 Calculate Resolution to obtain the encoder resolution.
Sensor settings
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 situation.
Trigger type: Only rising edge trigger is supported (cannot be configured).
Sensor calibration
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.
1. Click Start Listening in Sensor Set to start listening the sensor signal.
2. Place a workpiece on the upsteam of the conveyor. Control the conveyor to move. After the sensor
86
detects the workpiece and the workpiece is within the workspace of the robot, stop the conveyor.
3. Jog the robot to the workpiece center, then click Get to obtain the current position.
4. Click Calculate to obtain the position of the sensor.
After setting in this page, click Next to set the 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 obtaning 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.
87
In this example, you need to teach six points under the user coordinate system set when configuring the
conveyor belt.
Waiting point: P1
Tracking point: P2
Pickup point: P3
Lifting point: P4
Point above the placing point: P5
Placing point: P6
88
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
89
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
90
8 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 Dobot CRStudio 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 CRStudio interface and click Connect (it will turn to Disconnect after
successful connection).
91
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.
92
For details about tool coordinate system, refer to Tool coordinate system.
Editing project
For details on programming, refer to Blockly and Script. Here takes Blockly 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.
1. Open the Point page, move the robot arm to P1, and click Add.
93
4. Save the project.
94
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.
95
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.
96
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
97
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
31169 –
98
31192
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
99
1508 low
31509 char 1 1 byte U8 Joint speed rate
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)
100
1517 high Button board
31518 char 1 1 U8 playback signal
byte
(Not supported by
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)
Z-directional
31597 – double 1 8 1596 – 1599 F64 eccentric distance
101
31600 double 1 8 1596 – 1599 F64 eccentric distance
(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
102
Generate locking result:
49005 –
9004 – 9053 U16 Support at most 50 groups; 0 represents failure; 1
49054
represents success; 2 represents None
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
103
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
104
Quick start
105
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).
106
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).
107
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.
108
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.
109
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.
110
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.
111
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.
112
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.
113
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.
114
Block description
115
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.
116
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.
117
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 .
118
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.
119
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.
120
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.
121
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
122
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
123
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.
124
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.
125
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
126
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:
127
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.
128
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:
129
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:
130
Item index. You can directly fill the index in the blank, or use other oval blocks that return numeric
values.
Parameter:
Parameter:
131
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
132
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.
133
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.
134
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.
135
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:
136
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:
137
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:
138
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
139
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:
140
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.
141
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:
142
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:
143
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.
144
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.
145
Basic setting:
P: target point, which can be selected here after being added in the Point page, or defined in this page.
Advanced setting:
146
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.
147
Advanced setting:
JointMovJ
148
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
149
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.
150
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.
151
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.
152
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:
153
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.
154
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:
155
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.
156
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.
157
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:
158
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:
159
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.
160
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
161
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
163
Appendix C Script Commands
C.1 Lua basic grammar
C.2 Command description
164
Lua basic grammar
165
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
166
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:
167
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
168
(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
169
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
170
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
171
~= 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
172
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
173
print(i)
end
a = 10
repeat
print("This is a: ", a)
a = a + 1
until(a > 15)
174
Command description
175
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).
176
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.
177
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 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, AccelScommands for details, and the default
value is 100 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
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.
178
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:
179
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:
180
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:
181
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
182
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.
183
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:
184
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.
185
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:
186
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.
187
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} })
188
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.
189
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:
190
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:
191
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:
192
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:
193
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.
194
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:
195
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:
196
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.
197
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:
198
distance: collision backoff distance, range: [0,50], unit: mm.
Example:
SetBackDistance(20)
199
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.
200
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:
201
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:
202
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
203
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.
204
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})
205
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.
206
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:
207
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:
208
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:
209
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:
210
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:
211
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:
212
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
213
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:
214
Example:
SetABZPPC(1000)
GetABZ
Command:
GetABZ()
Description:
Return:
Example:
Get the resolution of configured ABZ encoder, and assign the value to the variable "abz".
215
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)
216
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)
217
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:
218
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:
219
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.
220
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")
221
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.
222
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:
223
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:
224
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
225
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:
226
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:
227
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)
228
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:
229
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:
230
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
231
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:
232
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.
233
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)
234
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.
235
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)
236
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,
237
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:
238
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.
239
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.
240
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:
241
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”)
242
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:
243
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”)
244
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:
245
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)
246
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)
247
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)
248
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.
249