0% found this document useful (0 votes)
18 views90 pages

Advance Trainning

Uploaded by

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

Advance Trainning

Uploaded by

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

Advance Training

01 DobotStudio Pro

CONTENT 02 Blockly

03 Modbus Communication Protocol

04 TCP/IP Communication Protocol

05 Scripting
01 DobotStudio Pro
DobotStudio Pro
DobotStudioPro is user-friendly, with easy-to-use functions and a simple and practical interface,
which can help users quickly master the use of Dobot robot.
DobotStudio Pro-Network Cable Connection

Connection

1. Connect the network cable

2. Modify the computer adapter IP


address to 5 network segment

PS: How to modify the IP address :


https://it.sohu.com/a/526524450_120464892

IP address

For cable connection, the default IP address


of CR robot is 192.168.5.1
DobotStudio Pro-Wired Connection Configuration

User Credential

• Press win+R to open the interface

• Input \\+Robot IP address

• User Credential Information

User Name: root Password: dobot

• Check the "Remember credentials"


box and click on "Confirm".

Note: Close the computer antivirus software


when using DobotStudioPro
DobotStudio Pro-Wireless Connection

WIFI

WIFI Name: Dobot_WIFI_Model+Serial Number

WIFI Password: 1234567890

IP Address

• For wireless connection, the default


IP address is 192.168.1.6

• After connection, we can press


win+R to enter the project

• Input \\192.168.1.6
DobotStudio Pro-Connect the Robot

Connection

• Open DobotStudioPro

• Wait for search robot and


IP address information

• Click【Connection】
DobotStudio Pro-Introduction
Blockly-New project
DobotStudio Pro-Points

【Points】Click to hide the Save Points panel, which can be


restored by clicking the "Save Points" button in the right toolbar. If
1
there are unsaved changes, a red * will be displayed in the upper
right corner.

2 Set the mode of RunTo function

3 Improt/Export the coordinate file

4 Click to collapse the control panel

[Point Management]

Click "Add" to save a new point.

Double click a point to modify the coordinate value directly.


5 Click "Cover" after selecting a point to overwrite the initial point
with the current point.

Press and hold "RunTo" to move the robot to that point.

Click "Delete" to delete the point.


DobotStudio Pro-Project
Save the project, click "Start" and the project will start running and display the logs.

• Click【Pause】to
suspend the program.

• Click【Resume】to
continue the program.

• Click【Stop】to end
the project.

• Click【Script】to
convert the blocks
into scripts.
02 Blockly-
A d va n c e d
Applications
Advanced Blockly Programming

• 1. Use Blockly to control the motor to


push the material---start the conveyor
rotation---wait for the robot to grab the
material---continue to repeat the
pushing action while the robot is
placing the material---end the sub-
thread after after 6 repetitions.

• 2. The robot grabs the material from the


conveyor belt, puts the material into the
tray and then returns to the safety
position and wait for the next material;

• 3. Repeat the above process until the


tray is put into 6 materials.
Advanced Blockly Programming

Steps for conveyor palletizing

Initialization Material Pickup Configure Placement


program detection subroutine pallet parameters subroutine
Initialization Program

Subroutine

Initialization

Print:Start initialization

Configure motion parameters

Turn off the input/output signals

Move to Home position

Print:Initialization completed
Initialization Program
Using subthread in material detection

Description Description

The main thread of the program. This The subroutine will run synchronously with the
block is included in the programming area main program, but the subthread cannot use
by default when you create a new project control commands, only variable operations or
IO control are available.

Restrictions Restrictions
There can be only one "Start" block in a project. A project can have up to 4 subroutines.
Material Detection
Subroutine start

Wait until the initialization is complete(lnit= 1)

Set digital output (subthread) Repeat

1.Return the pusher to its default position

2.Wait until "material detected" signal → Push material

3.Wait until the "front limit" signal → pusher backward


Description

4.Wait until the "back limit" signal → ① Stop the
pusher → ② Conveyor rotates
Set the specified DO on or off.
5.Wait until the "material detection 2" signal →
Parameters Conveyor stops

- Select the DO terminal, including the controller and tool. 6.Quantity increase 1

- Select the number of the DO. If ( put_count ) =7

- Select the state (ON or OFF). yes

End
Material Detection

Create three new variables in Custom

【Init】The initialization completion flag.


After initialization is complete, the sub-thread
waits for Init=1 before executing the pusher
action.

【pick_count】material counting, exiting the


subthread loop when 6 materials are pushed
out of the silo.

【put_count】material counting, exiting the


mainthread loop when 6 materials are placed.
Material Detection
Pickup Subroutine

Pickup

Set a picking point


Create subroutines

Move to Home Point

If there is a material
is

Move to the material

Turn on the air pump


Wait for 1s

Move up, then move to Home Point


Configure Pallet Block

Description Description
Description
Create a pallet. Get the count of the pallet Get the coordinates of the pallet
points. point.

Parameters
Parameters Parameters · The name of the pallet
The name of the pallet. The name of the pallet. · The number of the point.
Configure Pallet Block
Configure Pallet Block

Dimension
Configure the pallet ——
• One-dimensional: The materials are arranged in rows and the
Click the block to enter the configure panel 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 of X-direction and Y-direction.
• Three-dimensional: the materials are stacked in a cube, and the
total number of materials is equal to the product of the
numbers in the three directions.
Points

• The two-dimensional pallet needs to be configured with four


points. The control system will automatically calculate the target
points of each material by these four points and the number of
materials, and then sort them according to the order of X->Y
coordinate axes.
• When configuring the points, you can select the stored points
that have been set in the project, or you can click "Customize" to
get the current point coordinates of the robot. The icon of the
configured points will turn green.
Placement

Placement

Set transition point


Subroutine

Move to the transition point

Move to the placement point

turn off the sucking air pump

turn on the blowing air pump


Wait for 1s

Move up

Move to Home point


Main Program
Time for practice
20min
02 Modbus
Modbus TCP
Modbus is an industrial fieldbus protocol standard, introduced by Schneider in 1996 based on Ethernet
TCP/IP: ModbusTCP. Modbus is an application layer messaging protocol, including ASCII, RTU and TCP
message types. The standard Modbus protocol physical layer interfaces are RS232, RS422, RS485 and
Ethernet interfaces, using the master/slave method of communication. MODBUS TCP communication
messages are encapsulated in Ethernet TCP/IP packets. In contrast to the traditional serial approach, MODBUS
TCP inserts a standard MODBUS message into the TCP message, no longer with data checksum and address.
The Ethernet reference model used for communication, the Modbus TCP transport uses the 5 layers of the
TCP/IP Ethernet reference model:

Physical layer, which provides the physical interface to the device and is compatible with
Layer 1
commercially available media/network adapters

Layer 2 Data link layer, formatting signals to source/destination hardware-addressed data frames

Layer 3 Network layer, implementing IP packets with 32-bit IP addresses

Transport layer for reliable connectivity, transmission, error checking, retransmission,


Layer 4
port service, transmission scheduling

Layer 5 Application layer, Modbus protocol messages


Frame Structure PDU
PDU: Function code + data. The function code is 1 byte, the data length is determined by the specific function.

Function
Description Desccription
Code

Coil Output bits of the PLC, switchable, readable 0x01 read coil register
Register and writable in Modbus 0x05 write single coil register
Discrete Input bits of the PLC, switchable, read-only in
Input 0x0F write multiple coil registers
Register Modbus
0x02 read discrete input register
Registers that can only be changed from the
Input 0x04 read input register
analog inputs in the PLC, read-only in the
Register
0x03 read holding register
Modbus
0x06 write single holding register
Holding Registers for outputting analog signals in
Register 0x10 write multiple holding registers
PLC, readable and writable in Modbus
Modbus Communication - Four types of addresses
Based on our existing hardware interface, we currently use the Modbus-TCP.
Normally the Modbus address consists of 5 digits, including the starting data type designation, followed by
an offset address. The Modbus Master protocol library maps the standard Modbus address to the Modbus
function number, to read and write the data from the slave.

Modbus Master supports the following addresses:

Address Function Script

00001-09999 Digital output (coil register) GetCoils、SetCoils

Digital input (contact register/discrete


10001-19999 GetInBits
input)

30001-39999 Input register (usually analog input) GetInRegs

40001-49999 Holding register GetHoldRegs、SetHoldRegs

Based on the actual space available in the current controller software,


the number of coils, discrete inputs, inputs, and holding registers is 4096
When to use ModbusTCP communications

Use in PLC communication

Temperature
Sensor

Most of the sensors on the market


use Modbus to communicate with
the PLC to obtain sensor data.

Interaction between robot and PLC

Control of the robot and signal


transmission via Modbus communication
can replace the complicated wiring in the
IO communication method.
How to implement ModbusTCP communication with robots
Course Objective: To control the robot to pick and place materials via ModbusTCP communication and to
record the number of pallets.

Create Modbus communication Transfer data via Modbus Control robot’s motion,

and do some simple test record the number of the material


How to implement ModbusTCP communication with robots
Establish Modbus communication between the robot and debugging software to perform simple coil register
read/write.

Robot as Server writes Receive


Start End
ModbusTCP Server the values of coils and print the data

Connect
read the values Change the values
debuging software
in debuging software in debuging software
with robot server
Modbus Communication - Blockly

【Case 1】 The robot works as a Modbus master


Create Modbus Master and the PLC works as a Modbus slave.

IP: IP address of PLC

port: port number of PLC

slave_id: ID of PLC

Description
【Case 2】
Create a Modbus master and connect it to the slave.
The robot works as a Modbus slave and the PLC

Parameter works as a Modbus master.

- The IP address of the Modbus slave. IP: IP address of the robot

- The port of the Modbus slave. port: the port number of the robot

- The ID of the Modbus slave, the range is 1 ~ 4. slave_id: ID of the robot


Modbus Communication - Blockly

Read Coil Register Write Coil Register Wait Coil Register

Description Description Description


Get the value of the specified Set the value of the coil Wait for the value of the specified
address of the coil register. address to meet the condition
register specific address. before continuing to execute the
Parameters
next instruction.
The start address of the Parameters Parameters
coil register, the value
- Coil register start address, - The starting address of the coil
range: 0 ~ 4095.
value range: 6 ~ 4095. register, the range of values: 0 ~
Return Value
4095.
The value of the specified - The value to be written can
- The condition that the value
address of the coil register. only be 0 or 1. should be.
Modbus Communication - Blockly

Read Multiple Coil Registers Write Multiple Coil Registers

Description Description
Read the value of multiple consecutive coil Write the value of multiple consecutive coil
registers. registers.
Parameters Parameters
- Coil register start address, value range: 0 ~ - Coil register start address, the range of value: 0 ~
40z95. 4095.
- Read consecutive register bits.
- The bits of the value to be written.
Return Value
- Enter the value to be written, fill in an array with
The value of the specified address of the coil
register is stored in the table. the same length as the number of bits to be written,
The first value in the table is the value of the each bit can only be 0 or 1.
start address of the coil register.
Modbus Communication - Practice 1

Steps

01 Create a slave and connect it with ModbusPoll.

02 Use the write coil instruction to write the value of addresses 1000 to 1004 to 1.

03 first write 1 to the 1006, 1007 and 1009 addresses, then print the values from 1005 to 1009.

04 After waiting for the coil address 1010 to be 1, write 1000~1004 to 0.


ModbusTCP Communication
The robot communicates with the debugging software by creating Modbus communication, using holding
registers for integer data transfer, and the robot receives the data and runs to the corresponding point.

10 Move to P1

Robot as 20 Move to P2
Read the data of
Write the data of
Start ModbusTCP
hold register 1000 End
30 register 1005
Server Move to P3

40 Move to P14

Connect
Send the data to Read the data of
debuging software
register 1000 register 1005
with robot server
Modbus Communication - Blockly

Description Description Description


Set the value of the holding register Get the value of the holding register. Wait for a certain value of the holding

Parameters register to trigger the next instruction.


Parameters
· The start address, range: 0~4095. Parameters
· The start address, range: 0~4095. · Choose the data type:
· Choose the data type: - U16: 16-bit unsigned integer (2 bytes, · The start address, range: 0~4095.
- U16: 16-bit unsigned integer (2 bytes, 1 1 register) · Choose the data type:
register) - U32: 32-bit unsigned integer (4 bytes, - U16: 16-bit unsigned integer (2 bytes,
2 registers) 1 register)
- U32: 32-bit unsigned integer (4 bytes, 2
- F32: 32-bit single-precision floating- - U32: 32-bit unsigned integer (4 bytes,
registers) point number (4 bytes, 2 registers)
- F32: 32-bit single-precision floating- 2 registers)
- F64: 64-bit double-precision floating-
point number (4 bytes, 2 registers) point number (8 bytes, 4 registers) - F32: 32-bit single-precision floating-
- F64: 64-bit double-precision floating- point number (4 bytes, 2 registers)
point number (8 bytes, 4 registers) Return Value - F64: 64-bit double-precision floating-
The value of the holding register. point number (8 bytes, 4 registers)
· The reguired value
Modbus Communication - Practice 2

01 Create a slave and connect it with ModbusPoll.

If the value of register address 1000 is equal to 10, move the robot to P1, then write the value
02 of address 1005 to 10.

03 If the value of register address 1000 is equal to 20, move the robot to P2, then write the value
of address 1005 to 20.

If the value of register address 1000 is equal to 30, move the robot to P3, then write the value
04 of address 1005 to 30.

05 If the value of register address 1000 is equal to 40, move the robot to P4, then write the value
of address 1005 to 40.
Modbus Communication - Blockly

Description Description
Get the value of the input register. Get the value of the discrete input register.
Parameters Parameters
· The start address, range: 0~4095. · The start address, range: 0~4095.
· Choose the data type:
- U16: 16-bit unsigned integer (2 bytes, 1 register)
- U32: 32-bit unsigned integer (4 bytes, 2 registers) Return Value
- F32: 32-bit single-precision floating-point The value of the discrete input register.
number (4 bytes, 2 registers)
- F64: 64-bit double-precision floating-point
number (8 bytes, 4 registers)
Return Value
The value of the input register.
Modbus Communication - Blockly

Description Description
Wait for a certain value of the input register Wait for a certain value of the discrere input
to trigger the next instruction. register to trigger the next instruction.
Parameters
Parameters
· The start address, range: 0~4095.
· Choose the data type: · The start address, range: 0~4095.
- U16: 16-bit unsigned integer (2 bytes, 1
register) · The required value of the register.
- U32: 32-bit unsigned integer (4 bytes, 2
registers)
- F32: 32-bit single-precision floating-point
number (4 bytes, 2 registers)
- F64: 64-bit double-precision floating-point
number (8 bytes, 4 registers)
· The required value of the register.
Modbus Communication - Blockly

Description
Reads the value of consecutive holding registers.

Parameters
· Holding register start address, range: 0~4095
Read consecutive holding registers
· Number of the values.

· Choose the data type:


- U16: 16-bit unsigned integer (2 bytes, 1 register)
- U32: 32-bit unsigned integer (4 bytes, 2 registers)
- F32: 32-bit single-precision floating-point number (4
bytes, 2 registers)
- F64: 64-bit double-precision floating-point number (8
bytes, 4 registers)

Return Value
The values of the specific address which are
stored in table.
The first value in table is the value of the
start address.
Modbus Communication
Create ModbusTCP communications, control the robot to perform the corresponding actions.

Coil Register

Address PLC → Robot Address Robot → PLC

1000 Initialization 1005 Initializing

1001 Pickup 1006 Pickup completed

1002 Placement

Hold Register

Address PLC → Robot Address Robot → PLC

1000 Count the number of materials


Modbus Communication
Create ModbusTCP communications, control the robot to perform the corresponding actions.

Start Debuging Software


Create ModbusTCP Server (Robot) Connet robot server

The robot reads the coil address 1000 until the Set address 1000 to 1
coil value is 1, then starts initialization.

Set the value of coil address 1005 to 1 during robot


Read the value of address 1005
initialization; set to 0 after initialization is complete

The robot reads the coil address 1001 until the coil
Set address 1001 to 1
value is 1, and then performs the pickup action.
No

After the robot has finished picking, set the value


Read the value of address 1006
of coil address 1006 to 1

The robot reads the coil address 1002 , until


Set address 1002 to 1
the value is 1, start to unload.

After the robot has finished unloading, write the


Read the value of address 1000
number of materials to the holding register 1000

Is the number of discharges greater than 6


yes

End
Modbus Communication - Practice 3

01 Create a slave and connect it with ModbusPoll.

Wait for coil address 1000 to be 1, start the initialization program, write coil 1005 to 1. When
02
initialization is completed, write coil address 1005 to 0

If the value of address 1001 is 1, the robot will start to pick up the material. Write coil 1006
03 to 1 when the pickup is complete.

04 If the value of address 1002 is 1, the robot unloads the material and sets address 1006 to zero.

05 After placing a material, write the current quantity value into the holding register address 1000.

06 Repeat 6 times.
Modbus Communication - Remote Control Definition
Remote Output Description
Remote Control Definition(V3.5.2.0)
Feedback on whether the current script is
Script running status
Remote Input running or not

Run Script Feedback on whether the script is


Script Pause Status
currently paused
Pause script
Feedback on whether the current script is
Continue running the script Script Stop Status
in stop state

Stop script Whether the current script is in the alarm


Script Alarm Status
Clear alarms state
Restart if you encounter the alarm that cannot be cleared
Power on Script Warning Whether in the warning state (collision
If the emergency stop is taken, the alarm needs to be Status detection/safe skin collision)
cleared firstly
Emergency Stop Whether the current in the remote IO /
Remote Mode
Modbus control state

Whether the current robot is in the


Power Status power-down state (power-up state is
high, power-down state is low)
04 TCP/IP Protocol
TCP/IP Communication Theory
TCP/IP refers to a cluster of protocols that enable the transfer of information between several
different networks.

The TCP/IP protocol refers not only to the TCP and IP protocols, but to a cluster of protocols such as
FTP, SMTP, TCP, UDP, IP, etc. It is called the TCP/IP protocol because the TCP and IP protocols are the
most representative of the TCP/IP protocols.

Application layer Telnet FTP …

Transport layer TCP/UDP

ICMP ICMP

Network layer IP

ARP RARP

Data link layer Network Interface and Hardware Layer


TCP/IP Communication Protocol

Three-Way Handshake

TCP communication is established by


three-way handshake:

• A:B,Can you hear me?

(Send init signal, wait for confirmation.)

• B:A,Yes I can hear you.

(Receive and send confirmation)

• A:OK, I can hear you too.

(Receive and send confirmation)

Core Idea

The need for reliable and efficient data


transmission can be ensured by Three-way
hand shake.
TCP/IP Communication Protocol

Four-Way Wavehand

TCP communication is terminated by four-


way wavehand:

• A:Hi B, I will end this call

• B:OK,wait for me to finish

• B:All done here,you can end it.

• A:OK, goodbye

Core Idea

Fully understand that TCP is a stable and


reliable duplex communication.
When to use TCP/IP?

Vision Application

The robot needs to grasp a


randomly placed material
which requires a vision
camera to act as the robot's
eyes and tell the robot where
the material is located. The
vision has to send the
coordinates of the material to
the robot via TCP/IP
communication.
How to implement TCP/IP communication with robots
Objective: Simulate a vision application, the debugging tool establishes TCP communication with the robot
and the robot runs to the appropriate position by sending coordinates via the debugging tool.

Create Data Data Pack Point Data


TCP Server Transmission Test Processing Calculation
How to implement TCP/IP communication with robots
The robot creates a TCP server port to connect to the debugging tool , then sends and receives data with the
debugging tool.
Start

Create TCP Server and wait for the Debugging tool open up a client and
debugging tool to connect. connect to the robot

Send OK to the debugging tool after Debugging tool receive the data from the
successful connection robot

The robot wait for the debugging tool to Debugging tool send hello to the robot
receive data

Print to the screen after receiving hello

END
TCP/IP in Blockly

Connect SOCKET Create SOCKET

Description Description

Create TCP client, and communicate with the Create a TCP server and wait for the client
specified TCP server. to make a connection.
Parameters Parameters

• Select the SOCKET number to establish up • Select the SOCKET number to establish up to
to 4 TCP communication links. 4 TCP communication links.

• IP address of the TCP server. • The IP address of the TCP server.

• The port of the TCP server. • The port of the TCP server. Note that this
cannot be set to 502 or 8080.
TCP/IP in Blockly

Close SOCKET Send Variable

Description Description
Close the specified SOCKET to Sending variables via TCP communication.
disconnect this communication link.
Parameters Parameters

Select SOCKET Number • Select the SOCKET number.

• The data sent, can be filled in directly or


using other oval blocks with a return value
of string or variable.
TCP/IP in Blockly


Description

Obtain variable and save it via TCP


communication.
Parameters
参 数

• Select the SOCKET number.

• Select the type of variable to be


received, string and value are
supported.

• Variable to hold the received data,


using the created variable block.

• Timeout time, if set to 0, it will not


time out and will wait until the
variable is received.
TCP/IP in Blockly – Practice 1

01 Create a TCP server; IP: Robot local IP; port: 8000.

02 After successful connection, send OK to the debugging tool

03 Use the TCP helper to send a "hello" to the robot, then the robot receives it and prints it out.

Note: You need to turn off your computer's firewall, otherwise you may not be able to connect.
TCP/IP in Blockly – Practice 1
TCP/IP in Blockly – Practice 1
How to implement TCP/IP communication with robots
The robot creates a TCP server port, connects to the debug assistant, sends data using the debug assistant,
and the robot parses through the commands to extract the useful data for judgment.

Start

Create TCP Server and wait for the Debugging tool open up a client and
debugging tool to connect connect to the robot

Robot wait for the data from the The debugging tool send
debugging tool “100,200,300 ”to the robot

The robot split the received data

Take the second number from the result Debugging tool receive the number
and send to the debugging tool from the robot

END
TCP/IP in Blockly

Convert string to array Acquire the element with specified subscript

Description Description
Converts a specified string to an array, separating
Gets the element in the specified array at the
the strings according to the specified separator. For
specified subscript position. The subscript indicates
example, if the string is "1|2|3" and the separator is
the position of the element in the array, for
|, the converted array will be {[1]=1,[2]=2,[3]=3}.
example, the subscript of 8 in the array {7,8,9} is 2.
Parameters Parameters
• An oval block with a string return value or
• Target array, using the oval block with the
enter it directly.
return value of array.
• The separator used for the conversion.
• The subscript of the specified element.
Return Value
Return Value
The converted array. The value of the specified location in the array.
TCP/IP in Blockly – Practice 2

01 Create variables: [CPread] to store variables for incoming data; [SplitData] to store
variables for the split string.

Use the debugging tool to send a set of data, e.g. (100, 200, 300), splitting the data
02 using commas, and when the robot receives the data, it splits the data and prints the
result of the splitting 。

03 Send the second bit of the received data to the debug tool.
TCP/IP in Blockly – Practice 2
How to implement TCP/IP communication with robots
Create a TCP server port and send OK to the debugging tool after the robot has moved to the initial point.
The debugging tool sends coordinate offset data to the robot in a predefined format. After the robot is in
position, sends the In Position to the debug tool.

DT opens a client DT receive the data DT send GO,x,y


DT receive the data from the robot
Connect to the robot From the robot To the robot

Offset x, y based on P1, Send GONG


Send GOOK to the DT to the DT

Y N

If the first part is“GO”

Robot Create TCP server After connection


The robot wait to
Start Wait for debugging tool Robot move to P1
receive data from DT
Split the received data If the received data is END Y END
to connect Send OK to the tool
TCP/IP in Blockly

Splicing Two Strings Compare Two Strings

Description Description
Splice two strings into one string, the Compare the size of two strings according to
first string will be followed by the the ACSII code.
second. Parameters
Parameters The two strings to be compared. Can be filled in
The two strings to be spliced together either using oval blocks with a string return
Can be filled in either using oval blocks value or directly.
that return a string value or directly. Return Value
Return Value Returns 0 if string one and string two are equal,

The spliced string. -1 if string one is less than string two, 1 if string
one is greater than string two.
TCP/IP in Blockly

Description
Sets the value of the element in the

Set the specified element in an array array at the specified subscript


position.

Parameters
• Target array, using the elliptical
building blocks whose return value is
an array.

• Specified subscript of the element.

• Specified value of the element.


TCP/IP in Blockly – Practice 3

01 Creation of a TCP server, IP: the robot's local IP, port 8000.

02 The robot moves to point P1 after connection, sends OK to the debugging assistant.

03 The debugging assistant sends the offset values to the arm in the format "GO,x,y".

04 The robot receives data cyclically, splitting the received data according to ",".

If the received command is GO, the robot will offset based on the P1 point and send
05
"GOOK" to the debug assistant, otherwise, send GONG to the debug assistant.

06 When the robot receives an END, the cycle ends.


Script
05 Programming*
Script Programming Control Panel

Index Function Description

1 Control Panel Directly control the robot

2 Work Space Manipulate projects

3 Widget Command List

4 Editor Edit Scripts

Program
5 Control the program
Control

6 Robot Menu Enable/Alarm/E-Stop


Basic Programing
Lua is the programming language used in the SC series control cabinets, allowing the user the flexibility to
write the appropriate control program on the demonstrator according to the actual process requirements.

Arithmetic Operators Relational operators


Symbol Description Symbol Description
+ Addition
== Equal
- Subtraction
~= Not Equal
* Multiplication
<= Less or Equal
/ Floating point division operations
>= Greater or Equal
// Downward Integer Division
< Less than
% Modulo
> Greater than
^ Exponential

& Bitwise AND

\ Bitwise OR General symbols

~ Bitwise exclusive OR Symbol Description

<< Left Shift # Find the length of the table array

>> Right Shift


Basic Programming
Process Control Commands

Command Description

If the condition is true, the corresponding block is executed, and the


if…then…elseif…then…else…end
subsequent condition is ignored and not executed

This allows the program to execute certain statements repeatedly when the
while…do…end
condition is true.

Repeats the specified statement, the number of repetitions can be controlled


for…do…end
in the for statement

repeat… until() Repeats the loop until the specified condition is true
General keywords Logical Operators
Command Description Command Description
break Break the loop If one side is false, the result is false.
and
If both sides are true, the result is true.
Define local variables, valid only in the
local
script in which they are defined If one side is true, the result is true.
or
If both sides are false, the result is false.
nil Variable is a null value

return The return of the function The direct inverse of the result of a
not
judgment
enter Next line
Programming Language
Description
Robot global variables can be defined in the "global.lua" file, including the definition of global functions, global points,
global variables, etc.

Global Function

Global point example in 4-axis robot.

Global Points
Global point example in 6-axis robot.

Global Variables
Script Programming Standard

Queue Commands
Queue Commands
& Execute Commands
& Execute Commands
Queue
Common Queue Commands
The queue is executed in line, first-in,
first-execute. Motion Command, DO

Execute command, Wait Command


Common Execute Commands
Does not go into queue, execution
is not affected by queue DI Command, DOExecute
Command, Parameter setting
· What problem did this solve? commands.
Script Programming Standard

When the script is running, the yellow cursor on the


Sync Command host computer indicates that the script is running
and the green cursor indicates that the robot is
running. In most cases the two are not synchronized
and the script runs ahead of the robot.
Sync e.g.

Wait for the current Move(P1) -- Move to grabbing point


queue of instructions to
DO(1, ON) -- Grab the item
finish before moving on.
Wait(100) -- wait 100ms

Move(P2) -- Lift up

local isGrab = DI(1) --Check if grab is successful


Script Programming Standard

Without Sync(), the script runs quickly to the last line and returns
Sync command an isGrab value of 0. The robot is probably still on its way to P1. In
fact, we want the script to wait until the robot reaches P2 and the
two are synchronized before executing the last line to check for
isGrab. So add the Sync() command before the check, which
Use of Sync executes to the last line and returns an isGrab value of 1
Move(P1) -- Move to grabbing point
Sync() or
DO(1, ON) -- Grab the item
Go(P1,”SYNC=1”)
Wait(100) -- wait 100ms

Move(P2) -- Lift up

Sync() -- Synchronize, wait for grabbing process to complete

local isGrab = DI(1) --Check if grab is successful


Script Programming Standard

Standards

Use capital initial for functions


E.g. Connect()

ReceiveData()

RobotInit()

State the function and return value

The first initial should be in


lower case for variables.

E.g. receiveData={}

flagAgv=false

homePoint={}
Script Programming Standard

Programming
Specifications

- Business process description: aiming at the program can


be understood quickly by integrators/customers/FAE with
almost no communication
- Common function declarations: common function
functions without any modification, character splitting/TCP
- Business function statements: write actions and processes
according to the business
- IO and Modbus address descriptions: Explanation of the
IO and Modbus address definitions used
- Variable Definition Point Description: Variable meaning
and point set of points
- Main program: function call logic written according to the
business
Script Programming Standard-Practice

01 按照脚本编程规范进行脚本编程;

02 启动程序机械臂进行复位并回到 home 点,等待按下绿色按钮,机械臂进行取料;

03 取料完成后回到 home 点,等待按下红色按钮后,机械臂进行放料;

04 放料完成后回到 home 点,动作结束;


Script Programming Standard-Practice
Script Programming Standard-Practice
Script Programming Standard-Practice

Use blockly to control the push motor, after pushing the material, start the conveyor positive
01 rotation until the material is detected. After the robot finish picking, continue to repeat the
push action. The whole process will repeat 6 times and then end the sub-thread operation.

02 The robot picks up the materials and puts them into the tray.

03 Repeat the above process until 6 blocks are placed in the tray.
Emancipation of manpower
Optimization of Human-Machine Collaboration
Thank You

www.dobot-robots.com

400-800-7266

越疆机器人公众号

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy