8.Appendix-UFACTORY Private TCP protocol control
This section mainly explains how to control the BIO Gripper G2 by using the Modbus-TCP protocol through xArm control box.
8.1 UFACTORY Private TCP protocol
8.1.1 Register Address Description
Refer to 4.Modbus-RTU Communication Protocol Control
Modbus-TCP:
Modbus protocol is an application layer message transmission protocol, including three message types: ASCII, RTU, and TCP. The standard Modbus protocol physical layer interface includes RS232, RS422, RS485 and Ethernet interfaces, and adopts master / slave communication.
The BIO Gripper G2 supports the private TCP protocol, which is similar but not identical to the standard Modbus TCP.
Private Modbus TCP Communication Process:
- Establish a TCP connection
- Prepare Modbus messages
- Use the send command to send a message
- Wait for a response under the same connection
- Use the recv command to read the message and complete a data exchange
- When the communication task ends, close the TCP connection
Parameter:
- Default TCP Port: 502
- Protocol: 0x00 0x02
On the problem of users using communication protocols to organize data in big endian and little endian:
In this article, data analysis is big-endian analysis.
8.1.2 Read BIO Gripper Register
Register Function
Read Register | |||
---|---|---|---|
Request | |||
MBTP Header | Transaction Identifier | 2 Bytes | 0x0001 |
Protocol Identifier | 2 Bytes | 0x0002 | |
Length | 2 Bytes | 6+N*x2 | |
Unit Identifier | 1 Byte | 0x7C | |
Internal Use | Internal Use | 1 Byte | 0x09 |
Modbus RTU Data | Slave ID (Gripper) | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x03 | |
Register Starting Address | 2 Bytes | Address | |
Quantity of Registers | N*x2 Bytes | N* | |
Response | |||
MBTP Header | Transaction Identifier | 2 Bytes | 0x0001 |
Protocol Identifier | 2 Bytes | 0x0002 | |
Length | 2 Bytes | 6+N*x2 | |
Unit Identifier | 1 Byte | 0x7C | |
Status Value | 1 Byte | 0x00 | |
Internal Use | Internal Use | 1 Byte | 0x09 |
Modbus RTU Data | Slave ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x03 | |
Byte Count | 1 Byte | N*x2 | |
Registers Value | N*x2 Bytes | Value |
N* = Quantity of Registers
Address = Register Starting Address
Register Function
Resgister Starting Address | Registers Value | ||
---|---|---|---|
Get Gripper status Register | 0x0000 | 2 Bytes | Disabled: 0x0000 Enabling: 0x0004 Enabling completed: 0x0008 Stop status: 0x0008 Motion status: 0x0009 Clipping status: 0x000A Error status: 0x000B |
Get Gripper Error Register | 0x000F | 2 Bytes | An error occurs: all other return values indicate an error(except 0)No error occurred: 0x0000 |
8.1.3 Write BIO Gripper Register
Write Register | |||
---|---|---|---|
Request | |||
MBTP Header | Transaction Identifier | 2 Bytes | 0x0001 |
Protocol Identifier | 2 Bytes | 0x0002 | |
Length | 2 Bytes | 9+N*x2 | |
Unit Identifier | 1 Byte | 0x7C | |
Internal Use | Internal Use | 1 Byte | 0x09 |
Modbus RTU Data | Slave ID (Gripper) | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x10 | |
Register Starting Address | 2 Bytes | Address | |
Quantity of Registers | 2 Bytes | N* | |
Byte Count | 1 Byte | N*x2 | |
Registers Value | N*x2 Bytes | Value | |
Response | |||
MBTP Header | Transaction Identifier | 2 Bytes | 0x0001 |
Protocol Identifier | 2 Bytes | 0x0002 | |
Length | 2 Bytes | 0x0009 | |
Unit Identifier | 1 Byte | 0x7C | |
Status Value | 1 Byte | 0x00 | |
Internal Use | Internal Use | 1 Byte | 0x09 |
Modbus RTU Data | Slave ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x10 | |
Register Starting Address | 2 Bytes | Address | |
Quantity of Registers | 2 Bytes | N* |
N* = Quantity of Registers
Address = Register Starting Address
Resgister:
Resgister Starting Address | Register Value | ||
---|---|---|---|
Enable/Disable Gripper Register | 0x0100 | 2 Bytes | Enable : 0x0001 Disable : 0x0000 |
Set Gripper Position Register | 0x0700 | 4 Bytes | Open the Gripper : 0x0000 0x0082 Close the Gripper : 0x0000 0x0032 |
Set Gripper Speed Register | 0x0303 | 2 Bytes | 0x0000-0x0BB8 |
Clear Error Register | 0x000F | 2 Bytes | 0x0000 |
8.1.4 Private TCP Example
Use private TCP to control BIO Gripper G2 opening and closing, mode 0.
- Set the Bio Gripper G2 mode 0. Address: 0x010A, still effective after power failure.
Send:00 01 00 02 00 08 7C 09 08 06 11 0A 00 00
Response:00 01 00 02 00 09 7C 50 09 08 06 11 0A 00 00
- Enable the Gripper. Address: 0x0100
Send:00 01 00 02 00 0B 7C 09 08 10 01 00 00 01 02 00 01
Response:00 01 00 02 00 09 7C 50 09 08 10 01 00 00 01
- Open the Gripper
Mode 0 has no position control, sending position > 90, then opens the Bio Gripper G2. (OCT)130=(HEX)0082
Send:00 01 00 02 00 0d 7C 09 08 10 07 00 00 02 04 00 00 00 82
Response:00 01 00 02 00 09 7C 50 09 08 10 07 00 00 02
- Close the Gripper
Mode 0 has no position control and sends a position ≤ 90,then closes the Bio Gripper G2. (OCT)50=(HEX)0032
Send:00 01 00 02 00 0d 7C 09 08 10 07 00 00 02 04 00 00 00 32
Response:00 01 00 02 00 09 7C 50 09 08 10 07 00 00 02