Introduction to Script Protocol
Introduction
The script protocol supports external devices in sending script strings to the robot's controller, which will load the script and execute the commands.
Supported Transport Protocols and Port Numbers
The SCRIPT function module in the AUBO SDK supports TCP Socket, HTTP, and WebSocket transport protocols, with the corresponding port numbers as follows:
Protocol | Port number |
---|---|
TCP Socket | 30002 |
HTTP | 30003 |
WebSocket | 30003 |
Script Protocol Specification
Script strings sent from external devices to the robot controller via TCP Socket protocol must end with \r\n\r\n.
Example of Sending Script Strings
The following introduces examples of sending scripts via TCP Socket, HTTP, and WebSocket communication. The script string sent in the example is as follows:
Note: This script string is written for the i5 model robot arm.
return function(api)
local _ENV = require('aubo').sched.select_robot(1)
home = { -0.000003, -0.127267, -1.321124, 0.37694, -1.570796, -0.000008 }
move1 = { -0.400318, 0.064315, 0.547598, 3.14, 0.0, -2.63782 }
move2 = { -0.400318, 0.064315, 0.379989, 3.14, 0.0, -2.63782 }
move3 = { -0.400318, 0.064315, 0.547598, 3.14, 0.0, -2.63782 }
move4 = { -0.400319, -0.298610, 0.547598, 3.14, 0.435471, -1.57 }
move5 = { -0.400319, -0.243865, 0.429931, 3.14, 0.435471, -1.57 }
move6 = { -0.400319, -0.298610, 0.547598, 3.14, 0.435471, -1.57 }
-- Set the Tool Center Point (TCP offset relative to the flange center)
setTcpOffset({0,0,0,0,0,0})
-- Set the speed ratio
setSpeedFraction(0.75)
-- Joint movement
moveJoint(home, 3.14, 3.14, 0.0, 0)
-- Linear movement
moveLine(move1, 2, 1, 0.0, 0)
moveLine(move2, 2, 1, 0.0, 0)
moveLine(move3, 2, 1, 0.0, 0)
moveLine(move4, 2, 1, 0.02, 0)
moveLine(move5, 2, 1, 0.0, 0)
moveLine(move6, 2, 1, 0.02, 0)
end
Send Scripts Based on TCP Socket Communication
The IP address for sending scripts via TCP Socket is the robot's IP, and the port number is 30002.
The operation steps for sending script strings via the TCP Debug Assistant are described briefly below:
After entering the robot's IP address and port number, establish a connection. Once connected successfully, the Socket status shows connected.
Enter the script string, press the Enter key twice at the end of the script, and click "Send Data".
Note: The script string sent to the robot controller via the TCP Socket protocol must end with \r\n\r\n. \r\n represents the carriage return and line feed character. Therefore, after pasting the script into the TCP debugging assistant, it is necessary to press the Enter key at least twice at the end.
After successful sending, the received data will be displayed.
Send Scripts Based on WebSocket Communication
The URL address for sending scripts via WebSocket is ws://localhost:30003. Here, localhost represents the robot's IP address, and 30003 is the port number for WebSocket.
The operation steps for sending script strings via the web-based WebSocket testing tool are described briefly below:
WebSocket online testing tool: [EasySwoole-WebSocket Online Testing Tool] (http://www.easyswoole.com/wstool.html)
After entering the URL address, establish a connection. Once connected successfully, the server configuration status shows that the connection is successful.
Enter the script string and click "Send to Server".
After successful sending, the received message will be displayed.
Sending Script Based on HTTP Communication Example
The URL address for sending the script via HTTP is localhost:30003/aubo_script. Here, localhost represents the robot's IP address, and 30003 is the port number for HTTP.
The operation steps for sending script strings via the Postman are described briefly below:
Open Postman, select the request action as POST, and enter the URL address.
In the Body section, enter the script string and click "Send".
After successful sending, the received message will be displayed.