0% found this document useful (0 votes)
12 views57 pages

HansRobotV5 Communication Protocol(Linux)English(1)

The document outlines the HansRobot Communication Protocol Interface developed by Shenzhen Han’s Robot Co., Ltd., detailing its purpose, structure, and various commands for controlling the robot. It includes a comprehensive list of commands, their formats, and expected responses, along with connection modes and examples for users. The document serves as a reference for R&D personnel and users utilizing the HansRobot protocol interface for robot control and communication.

Uploaded by

hoang
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)
12 views57 pages

HansRobotV5 Communication Protocol(Linux)English(1)

The document outlines the HansRobot Communication Protocol Interface developed by Shenzhen Han’s Robot Co., Ltd., detailing its purpose, structure, and various commands for controlling the robot. It includes a comprehensive list of commands, their formats, and expected responses, along with connection modes and examples for users. The document serves as a reference for R&D personnel and users utilizing the HansRobot protocol interface for robot control and communication.

Uploaded by

hoang
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/ 57

Shenzhen Han’s Robot Co.,Ltd.

HansRobot Communication Protocol Interface

HansRobotV5
Communication Protocol Interface

Shenzhen Han’s Robot Co.,Ltd.


Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

1、Edit History:

Version No. Date Modified Content

V5 2019-12-3
WEB5.42.12.b14_CPS154.58 2020-10-14
WEB5.42.28_CPS182.74 2020-11-24
HR.WEB5.45.30.b20_CPS217.106 2021-04-12

2、Purpose of this document:

 Provide reference for interface preparation and maintenance of R&D


personnel
 Provide interface usage instructions for other users who use the
Hansrobot protocol interface
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

1 INTERFACE PREVIEW....................................................................................................... 1

2 INTRODUCTION...................................................................................................................4

2.1 OVERVIEW.........................................................................................................................4

2.2 MESSAGE FORMAT............................................................................................................ 4

2.3 GLOSSARY.........................................................................................................................5

3 SYSTEM STRUCTURE.........................................................................................................6

3.1 CONNECTION MODE..........................................................................................................6

3.1.1 As Client....................................................................................................................... 6

3.1.2 As Server.......................................................................................................................6

3.1.3 Configuration File........................................................................................................ 7

3.1.4 Connection examples....................................................................................................7

3.2 SERVO PORT TABLE........................................................................................................ 11

4 COMMUNICATION PROTOCOL.................................................................................... 12

4.1 ELECTRIFY...................................................................................................................... 12

4.2 BLACKOUT..................................................................................................................... 12

4.3 STARTMASTER................................................................................................................ 13

4.4 CLOSEMASTER............................................................................................................... 13

4.5 GRPPOWERON................................................................................................................ 13

4.6 GRPPOWEROFF............................................................................................................... 14

4.7 GRPSTOP.........................................................................................................................14

4.8 GRPRESET.......................................................................................................................15

4.9 GRPINTERRUPT............................................................................................................... 15

4.10 GRPCONTINUE................................................................................................................ 15

4.11 GRPOPENFREEDRIVER................................................................................................... 16

4.12 GRPCLOSEFREEDRIVER..................................................................................................16

4.13 SETTCPBYNAME........................................................................................................... 17

4.14 SETUCSBYNAME...........................................................................................................17

4.15 SETOVERRIDE................................................................................................................. 18

4.16 SETENDDO.....................................................................................................................18

4.17 SETBOXDO.....................................................................................................................19

4.18 SETBOXCO.....................................................................................................................20

4.19 SETBOXAO.....................................................................................................................20
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4.20 SETBOXAOMODE.......................................................................................................... 21

4.21 READEI...........................................................................................................................21

4.22 READEO......................................................................................................................... 22

4.23 READEAI........................................................................................................................ 22

4.24 READBOXDI................................................................................................................... 23

4.25 READBOXCI................................................................................................................... 24

4.26 READBOXCO..................................................................................................................24

4.27 READBOXDO................................................................................................................. 25

4.28 READBOXAO................................................................................................................. 25

4.29 READBOXAI................................................................................................................... 26

4.30 READACTPOS................................................................................................................. 26

4.31 READOVERRIDE..............................................................................................................28

4.32 READROBOTSTATE..........................................................................................................28

4.33 READCURFSM............................................................................................................... 30

4.34 PCS2ACS.......................................................................................................................32

4.35 WAYPOINT...................................................................................................................... 33

4.36 MOVEJ............................................................................................................................ 34

4.37 MOVEL........................................................................................................................... 35

4.1 SHORTJOGJ..................................................................................................................... 36

4.2 SHORTJOGL.................................................................................................................... 37

4.3 PAUSESCRIPT.................................................................................................................. 37

4.4 CONTINUSSCRIPT............................................................................................................38

4.5 STARTSCRIPT.................................................................................................................. 38

4.6 RUNFUNC........................................................................................................................38

4.7 STOPSCRIPT.................................................................................................................... 39

4.8 STARTPUSHMOVEPATH................................................................................................... 40

4.9 PUSHMOVEPATHJ............................................................................................................40

4.1 PUSHMOVEPATHL...........................................................................................................41

4.2 ENDPUSHMOVEPATH...................................................................................................... 42

4.3 MOVEPATH......................................................................................................................43

4.4 READMOVEPATHSTATE...................................................................................................43

4.5 STARTSERVO................................................................................................................... 44

4.6 PUSHSERVOJ................................................................................................................... 44

4.7 PUSHSERVOP.................................................................................................................. 45
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

5 DATASHEET SERVICE...................................................................................................... 47

5.1 CONTENTS.......................................................................................................................47

5.2 Headers.......................................................................................... 错误!未定义书签。

6 CONTROL ROBOT MOVEMENT PROCESS – EXAMPLE........................................ 50

6.1 MOTION FLOW CHART....................................................................................................... 50

6.2 CODE SAMPLE................................................................................................................... 51


Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

1 Interface Preview

Interface Description

Electrify Power the robot

BlackOut Robot Blackout

StartMaster Start Master

CloseMaster Close Master

GrpPowerOn Robot servo on

GrpPowerOff Robot servo off

GrpReset Reset to clear errors

GrpStop Stop robot

GrpInterrupt Pause the current movement

GrpContinue Continue the suspended motion

GrpOpenFreeDriver Open free drive mode

GrpCloseFreeDriver Close the free drive mode

SetTCPByName Set TCP by name

SetUCSByName Set USC by name

SetOverride Set speed ratio

SetEndDO Set end DO status

SetBoxDO Set the output IO status of the common serial port of

control box

SetBoxCO Set the output IO status of the functional serial port

of control box

SetBoxAO Set serial port analog output of control box

SetBoxAOMode Set serial port analog mode of control box

ReadEI Read the input IO status of end port

ReadEO Read the output IO status of end port

1
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

ReadEAI Read the analog input of end port

ReadBoxDI Get the status of the digital input of control box

ReadBoxCI Get the status of the functional digital input of

control box

ReadBoxDO Get the status of the digital output of control box

ReadBoxCO Get the status of the functional digital output of

control box

ReadBoxAO Get the analog output of control box

ReadBoxAI Get the analog input of control box

ReadActPos Read the current actual APC, ACS

ReadOverride Read the speed ratio

ReadRobotState Read the state of robot

ReadCurFSM Read the current FSM of robot

PCS2ACS inverse kinematics, the Cartesian position is

converted to the joint position

WayPoint Waypoint motion

MoveJ Robot moves to the specified angular coordinate

position

MoveL Robot moves straight to the specified space


coordinate position
ShortJogJ Jog movement for joint

ShortJogL Jog movement for Cartesian coordinate system

PauseScript Pause the script

ContinusScript Continue the script

StartScript Start the script

RunFunc Run script functions separately

StopScript Stop the script

StartPushDragMove Add the trajectory for DragMove

2
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

PushDragMove Add the points of trajectory for DragMove

PushDragMoveL Add the points of trajectory for DragMoveL

EndPushDragMove End adding points of trajectory for DragMove

DragMove Run the DragMove trajectory

ReadDragMoveState Read the State of DragMove

StartServo Set the fixed update cycle and look-ahead time when

starting the robot online control (servoJ or servoP)

PushServoJ Online joint position command control, the joint

position is sent with the fixed update time set by

StartServo, and the robot will track the joint position

command in real time.

PushServoP The online terminal TCP position command control

transmits the TCPposition with the fixed update time

set by the StartServo, and the robot reversely

converts the target position of the target TCP position

in real time.

3
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

2 Introduction

2.1 Overview

HansRobot communication protocol interface mainly provides


HansRobot communication protocol standard. In accordance with content
of this agreement, the user sends the designated messaged to the robot
control system through tcp/ip (Hereinafter referred to as the control
system). The control system is processed separately according to different
message contents, and the processing result is returned to the sender
server.
Messages for movement types, the control system returns the result
of the command immediately (Typically, the return is 0, Indicating that
the command is successful and the others are error codes). Then the
movement message sender needs to send the "ReadMoveState" message
constantly to get the movement whether done or not. In general, the next
movement can be performed only when the robot has completed the
current work.
For other types of messages, the control system returns the request
result. For specific results, please see the communication protocol.
The communication system only processes one full message at a
time. For example, when sending multiple messages at once, the control
system processes only the first message that satisfies the protocol format,
other discard. If the message sent is incomplete, the control system
returns the invalid result of the command.

2.2 Message Format

(1)Communication protocol
Message name, Param1,Param2,Param3……Paramn,;
The message format, as shown above, is composed of a message
4
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

name and parameters. A complete message ends in English comma and


semicolon, where each field is separated by an English comma.
Message commands and message replies are all in the ASCII format
(String form).
The specific message format is shown in reference 3.
The parameter that is not used is assigned 0.
(2) Return format
1) Succeful return
Message name,OK,Param1,Param2,Param3……Paramn,;
The message format, as shown above,consists of a message name, a
success flag OK and parameters. A complete message ends in English
comma and semicolon, where each field is separated by an English
comma.
2) Fail to return
Message name, Fail, ErrorCode,;
The message format, as shown above,consists of a message name, a
failure flag Fail and error message code. A complete message ends in
English comma and semicolon, where each field is separated by an
English comma.
The error code is in the form of 'int'.
The specific error code is shown in reference 4.

2.3 Glossary

Glossary Meaning
ACS Joint coordinates in degrees
PCS Spatial coordinates in millimeters and degrees

5
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

3 System Structure
The protocol adopts the standard C/S architecture, in which the
Han's Robot provides a server that receives and processes robot control
messages, and the entire communication process is performed by TCP/IP.

Fig 1-1 system structure

3.1 Connection Mode

3.1.1 As Client

As a communication client, the Hans robot control system will


continuously monitor the connection server signal (triggered in the form
of IO) sent by the upper monitor. The client of the upper monitor will
configure the IP address and port according to the configuration file. No.
and actively connect to the host computer server by using TCP/IP
communication protocol after receiving the connection IO signal. If the
client of the upper monitor is already connected to the server before the
server sends a connection signal again, the client of the upper monitor
will close the current connection firstly and then connect to the server.

Figure: Connection Method

3.1.2 As Server

As the communication server, the Han's Robot Control System will


6
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

continuously monitor the designated port when it is started, and wait for
the connection of the host computer client. Among them, the port number
monitored by the server can be set through the configuration file.

3.1.3 Configuration File

By modifying the parameters through the communication protocol, it


will not be saved to the configuration file, that is, it is valid for a single
time. Restart the controller and the default parameters will be restored.
The parameters set in the HansRobot teach pendant will be saved to the
configuration file.

3.1.4 Connection examples

1. Communicate with the same control box


(1) The controller acts as the server and the client software acts as the client.
Take NetAssist.exe as an example:
NetAssist as the client, the IP address is the address of the machine, and
the port is 10003

7
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

2. Controller communicates with laptop


(1) Connect the industrial controller and the laptop by using a network cable
(2) Modify the IP address of industrial controller and laptop to be in the
same domin.
a)Modify the IP of industrial controller

8
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

a)Modify the IP address of laptop

9
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

(3) The controller acts as the server and the client software acts as the client.
Take NetAssist.exe as an example:
NetAssist is the client, the IP address is the IP address, and the port is
10003

10
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

3.2 Servo Port Table

Servo Port Function

10003
IF command service port
10004
Datasheet servo port which regularly pushes datasheet to clients
10502
ModbusTCP server, the holding registers of 0~99 are used
30003
The log server will send logs to the client when logs are generated

11
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4 Communication Protocol

4.1 Electrify

Function: Power the robot


Format: Electrify,;
Parameter quantity: None
Successful return:
”Electrify,OK,;”
Note: When the master station is started, it will return to the successful
power-on. It is recommended to read the DCS status continuously
through the ReadDCSStatus interface until the current status to be normal,
and then perform other operations.

Fail to return:
” Electrify,Fail,ErrorCode,;”, error types see the error code list
Example
Electrify,;

4.2 BlackOut

Function: Power off the robot


Format: BlackOut,;
Parameter quantity: None
Successful return:
”BlackOut,OK,;”
Notes: It will not return until the successful blackout is completed.

Fail to return:
”BlackOut,Fail,ErrorCode,;”, error types see the error code list
Example
BlackOut,;

12
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4.3 StartMaster

Function: Start master station


Format: StartMaster,;
Parameter quantity:None
Successful return:
”StartMaster,OK,;”
Notes: It is recommended to read the DCS status continuously through the
ReadDCSStatus interface until the current status to be normal, and then
perform other operations.

Fail to return:
”StartMaster,Fail,ErrorCode,;”, error types see the error code list
Example:
StartMaster,;

4.4 CloseMaster

Function: Close master station


Format: CloseMaster,;
Parameter quantity: None
Successful return:
”CloseMaster,OK,;”
Notes: the master station will not be returned until successfully closed, shut down
the master station time is about 2s.
Fail to return:
”CloseMaster,Fail,ErrorCode,;”, error types see the error code list
Example:
CloseMaster,;

4.5 GrpPowerOn

Function: Robot servo on


Format: GrpPowerOn,rbtID,;
Parameter quantity: 1
Successful return:
”GrpPowerOn,OK,;”
Fail to return:
”GrpPowerOn,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:1
13
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter name Type Meaning


rbtID int Robot index, count from zero

Example
GrpPowerOn,0,;

4.6 GrpPowerOff

Function: Robot servo off


Format: GrpPowerOff,rbtID,;
Parameter quantity:1
Successful return:
”GrpPowerOff,OK,;”
Fail to return:
”GrpPowerOff,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter Name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpPowerOff,0,;

4.7 GrpStop

Function: Stop robot


Format: GrpStop,rbtID,;
Parameter quantity: 1
Successful return:
”GrpStop,OK,;”
Fail to return:
”GrpStop,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example
14
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

GrpStop,0,;

4.8 GrpReset

Function: Reset to clear errors


Format: GrpReset,rbtID,;
Parameter quantity: 1
Successful return:
”GrpReset,OK,;”
Fail to return:
”GrpReset,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpReset,0,;

4.9 GrpInterrupt

Function: Pause the current movement


Format: GrpInterrupt,rbtID,;
Parameter quantity: 1
Successful return:
”GrpInterrupt,OK,;”
Fail to return:
” GrpInterrupt,Fail,ErrorCode,;”, error types see the error code list
Paramter details:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpInterrupt,0,;

4.10 GrpContinue

Function: Continue the suspended motion


Format:GrpContinue,rbtID,;

15
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter quantity: 1
Successful return:
”GrpContinue,OK,;”
Fail to return:
” GrpContinue,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpContinue,0,;

4.11 GrpOpenFreeDriver

Function: Start free driver mode


Format: GrpOpenFreeDriver,rbtID,;
Parameter quantity: 1
Successful return:
” GrpOpenFreeDriver,OK,;”
Fail to return:
” GrpOpenFreeDriver,Fail,ErrorCode,;”, error types see the error
code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpOpenFreeDriver,0,;

4.12 GrpCloseFreeDriver

Function: Close free drive mode


Format: GrpCloseFreeDriver,rbtID,;
Parameter quantity: 1

16
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Successful return:
” GrpCloseFreeDriver,OK,;”
Fail to return:
” GrpCloseFreeDriver,Fail,ErrorCode,;”, error types see the error
code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Example:
GrpCloseFreeDriver,0,;

4.13 SetTCPByName

Function: Set the value in the TCP list as the current TCP coordinate by name
Format: SetTCPByName,rbtID,tcpname,;
Parameter quantity: 2
Successful return:
”SetTCPByName,OK,;”
Fail to return:
” SetTCPByName,Fail,ErrorCode,;”, error types see the error code
list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
tcpname string The name of TCP
Example:
SetTCPByName,0,TCP,;

4.14 SetUCSByName

Function: Set the value in the user coordinate list as the current user
coordinate by name
Format: SetUCSByName,rbtID,ucsname,;

17
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter quantity: 2
Successful return:
SetUCSByName,OK,;”
Fail to return:
” SetUCSByName,Fail,ErrorCode,;”, error types see the error code
list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
ucsname string The name of UCS
Example:
SetUCSByName,0,Base,;

4.15 SetOverride

Function: Set speed ratio


Format: SetOverride,rbtID,override,;
Parameter quantity: 2
Successful return:
”SetOverride,OK,;”
Fail to return:
” SetOverride,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Set the speed ratio in the range of
Override double
0.01 ~ 1 (1% ~ 100%)
Example:
SetOverride,0,0.05,;

4.16 SetEndDO

Function: Set end output IO status

18
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Format: SetEndDO,rbtID,ioIndex, ioState,;


Parameter quantity: 3
Successful return:
”SetEndDO,OK,;”
Fail to return:
” SetEndDO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
ioIndex int The index of the output IO to be
set varies from robot to robot, and
it needs to be set according to the
specific robot.
ioState int The state that needs to be set
(0: low level; 1: high level;)
Example:
SetEndDO,0,1,1,;

4.17 SetBoxDO

Function: Set the general output IO status of the control box


Format: SetBoxDO,bit,state,;
Parameter quantity: 2
Successful return:
”SetBoxDO,OK,;”
Fail to return:
” SetBoxDO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit int Set the general output IO status of
the control box
state int Set status: 0 = low level;1 = high
level;
Example:
19
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

SetBoxDO,1,1,;

4.18 SetBoxCO

Function: Set the function output IO status of the control box


Format: SetBoxCO,bit,state,;
Parameter quantity: 2
Successful return:
”SetBoxCO,OK,;”
Fail to return:
” SetBoxCO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit int The serial port bit to be set, starting from
0
state int Set status: 0 = low level;1 = high level;
Example:
SetBoxCO,1,1,;

4.19 SetBoxAO

Function: Set the analog output of the control box


Format: SetBoxAO, nIndex, dValue , nPattern,;
Parameter quantity: 3
Successful return:
” SetBoxAO,OK,;”
Fail to return:
” SetBoxAO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
nIndex int Analog channel, starting from 0
dValue double Analog value, voltage: 0 ~ 10V, current:

20
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4 ~ 20mA
nPattern int Analog type, 0 = voltage, 1 = current
Example:
SetBoxAO,0,5,1,;

4.20 SetBoxAOMode

Function: Set serial port analog mode


Format: SetBoxAOMode, nIndex, nPattern,;
Parameter quantity: 2
Successful return:
” SetBoxAOMode,OK,;”
Fail to return:
” SetBoxAOMode,Fail,ErrorCode,;”, error types see the error code
list
Parameter detail:
Parameter name Type Meaning
nIndex int Analog channel, starting from 0
nPattern int Analog type, 0 = voltage, 1 = current
Example:
SetBoxAOMode,0,1,;

4.21 ReadEI

Function: Read the status of end input IO


Format: ReadEI,rbtID,ioIndex,;
Parameter quantity: 2
Successful return:
” ReadEI,OK,state,;”
Fail to return:
” ReadEI,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:

21
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter name Type Meaning


rbtID Int Robot index, count from zero
ioIndex int IO index to read
State int Status of input IO:
0 = low level;
1 = high level;
Example:
ReadEI,0,1,;

4.22 ReadEO

Function: Read the status of end output IO


Format: ReadEO,rbtID,ioIndex,;
Parameter quantity: 2
Successful return:
” ReadEO,OK,state,;”
Fail to return:
” ReadEO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
ioIndex int IO index to read
state int Status of output IO:
0 = low level;
1 = high level;

Example:
ReadEndDO,0,1,;

4.23 ReadEAI

Function: Read end analog input channel 1

22
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Format: ReadEAI,rbtID,ioIndex,;
Parameter quantity: 1
Successful return:
” ReadEAI,OK,dValue,;”
Fail to return:
” ReadEAI,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
ioIndex int End analog input index to be read
dValue double Returned analog value
Example:
ReadEAI,0,;

4.24 ReadBoxDI

Function: Obtain the status of the general input bit specified by the
control box
Format: ReadBoxDI,bit,;
Parameter quantity: 1
Successful return:
”ReadBoxDI,OK,state,;”
Fail to return:
” ReadBoxDI,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit Int The input bit to get, starting from
0
State Int Return status, 0 = low level;1 =
high level;
Example:
ReadBoxDI,1,;
23
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4.25 ReadBoxCI

Function: Obtain the status of the function input bit specified by the
control box
Format: ReadBoxCI,bit,;
Parameter quantity: 1
Successful return:
”ReadBoxCI,OK,state,;”
Fail to return:
” ReadBoxCI,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
Bit Int The input bit to get, starting from
0
State Int Return status, 0 = low level;1 =
high level;
Example:
ReadBoxCI,1,;

4.26 ReadBoxCO

Function: Obtain the status of the function output bit specified by the control
box
Format: ReadBoxCO,bit,;
Parameter quantity: 1
Successful return:
”ReadBoxCO,OK,state,;”
Failure Return:
” ReadBoxCO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:

24
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter name Type Meaning


bit Int The output bit to get, starting from 0
State Int Return status, 0 = low level;1 = high
level;
Example:
ReadBoxCO,1,;

4.27 ReadBoxDO

Function: Obtain the status of the general output bit specified by the
control box
Format: ReadBoxDO,bit,;
Parameter quantity: 1
Successful return:
” ReadBoxDO,OK,state,;”
Failure Return:
” ReadBoxDO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit Int The output bit to get, starting from
0
State Int Return status, 0 = low level;1 =
high level;
Example:
ReadBoxDO,1,;

4.28 ReadBoxAO

Function: Get the analog output of channel 1 of the control box


Format: ReadBoxAO,bit,;
Parameter quantity: 0
Successful return:

25
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

”ReadBoxAO,OK,nVal,;”
Failure Return:
” ReadBoxAO,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit Int The analog output bit to be
obtained, 0~3
nVal double Returned control box analog output
Example:
ReadBoxAO,0,;

4.29 ReadBoxAI

Function: Get the analog input of channel 1 of the electrical box


Format: ReadBoxAI,bit,;
Parameter quantity: 0
Successful return:
”ReadBoxAI,OK,nVal,;”
Failure Return:
” ReadBoxAI,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
bit Int Analog output bits to be obtained, 0 ~ 3
nVal double Returned control box analog output
Example:
ReadBoxAI,0,;

4.30 ReadActPos

Function: Get the actual location


Format: ReadActPos,rbtID,;
Parameter quantity: 1

26
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Successful return:
” ReadActPos,OK ,J1,J2,J3,J4,J5,J6, X,Y,Z,RX,RY,RZ,
X_TCP,Y_TCP,Z_TCP,RX_TCP,RY_TCP,RZ_TCP,
X_UCS,Y_UCS,Z_UCS,RX_UCS,RY_UCS,RZ_UCS,;”
Fail to return:
” ReadActPos,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
J1 double J1 axis position in degrees
J2 double J2 axis position in degrees
J3 double J3 axis position in degrees
J4 double J4 axis position in degrees
J5 double J5 axis position in degrees
J6 double J6 axis position in degrees
X double X-axis position in mm
Y double Y-axis position in mm
Z double Z-axis position in mm
RX double RX axis position in degrees
RY double Ry axis position in degrees
RZ double RZ axis position in degrees
X_TCP double X-axis position of TCP, unit: mm
Y_TCP double Y-axis position of TCP, unit: mm
Z_TCP double Z-axis position of TCP, unit: mm
RX_TCP double RX axis position of TCP in
degrees
RY_TCP double Ry axis position of TCP in degrees
RZ_TCP double RZ axis position of TCP in degrees
X_UCS double The x-axis position of the UCS, in
millimeters
Y_UCS double Y-axis position of UCS, unit: mm
Z_UCS double Z-axis position of UCS in mm

27
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

RX_UCS double RX axis position of UCS in


degrees
RY_UCS double Ry axis position of UCS, in
degrees
RZ_UCS double RZ axis position of UCS in
degrees
Example:
ReadActPos,0,;

4.31 ReadOverride

Function: Read the value of speed


Format: ReadOverride,rbtID,;
Parameter quantity: 1
Successful return:
” ReadOverride,OK,Override,;”
Fail to return:
” ReadOverride,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:

Parameter name Type Meaning


rbtID Int Robot index, count from zero
Override Double Rate ratio, 0.01 ~ 1 (1% ~ 100%)
Example:
ReadOverride,0,;

4.32 ReadRobotState

Function: Read the status of the robot


Format: ReadRobotState,rbtID,;
Parameter quantity: 1

28
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Successful return:
” ReadRobotState,OK,movingState,powerState,errorState,
errorCode,errAxisID,BrakingState, HoldingState, EmergencyStop , SaftyGuard, Electrify,
IsConnectToBox, blendingDone, inpos,;”
Failure Return:
” ReadRobotState,Fail,ErrorCode,;”, error types see the error code
list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
movingState int 0 = no movement
1 = in motion
powerState int 0 = de enable state
1 = enable status
errorState int 0 = no error reported
1 = error reporting
errorCode int Robot specific error code
errAxisID Int Axis ID reported by manipulator
BrakingState int 0 = no brake operation
1 = brake in operation
HoldingState int
EmergencyStop int 0 = no emergency stop, 1 =
emergency stop
SaftyGuard int 0 = no safety light curtain, 1 =
safety light curtain
Electrify int 0 = not powered on, 1 = powered
on
IsConnectToBox int 0 = not connected to the control
box, 1 = connected to the control
box
blendingDone int This flag is required only when
waypoint is used
0 = blending motion not

29
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

completed
1 = blending movement
completed
inpos int 0 = not in place (it may be in
motion, or it may be wrong in
motion, so it is not in place)
1 = in place
Example:
ReadRobotState,0,;

4.33 ReadCurFSM

Function: Read the state machine of the controller. This interface


ReadRobotState has a certain difference, and the state machine is also
judged based on some signs of ReadRobotState. It is a global state
machine.
Format: ReadCurFSM,rbtID,;
Parameter quantity: 1
Successful return:
” ReadCurFSM,OK,CurFSM,;”
Fail to return:
” ReadCurFSM,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
CurFSM int State machine value
State machine definition
Value Alias Meaning
0 UnInitialize Uninitialized
1 Initialize Initialization
2 ElectricBoxDisconnect Disconnect from control box
control board

30
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

3 ElectricBoxConnecting Connect control box control board


4 EmergencyStopHandling Emergency stop processing
5 EmergencyStop Emergency stop
6 Blackouting48V Cutting off the power supply of
the body
7 Blackout_48V The power supply of the body has
been cut off
8 Electrifying48V Preparing to supply power to the
body
9 SaftyGuardErrorHandling Error handling of safety light
curtain
10 SaftyGuardError Security light curtain error
11 SafetyGuardHandling Safety light curtain processing
12 SaftyGuard Safety light curtain
13 ControllerDisconnecting Uninitializing controller
14 ControllerDisconnect The controller has been processed
in an uninitialized state
15 ControllerConnecting Initializing controller
16 ControllerVersionError Controller version too low error
17 EtherCATError EtherCAT error
18 ControllerChecking Check after controller
initialization
19 Reseting Resetting robot
20 RobotOutofSafeSpace Robot out of safe space
21 RobotCollisionStop Robot safe collision parking
22 Error Robot error
23 RobotEnabling Robot enabling
24 Disable Robot to enable
25 Moveing In robot motion
26 LongJogMoveing In the long inching motion of
robot
27 RobotStopping The robot is stopping

31
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

28 RobotDisabling Robot de enabling


29 RobotOpeningFreeDriver The robot is starting zero force
teaching
30 RobotClosingFreeDriver The robot is turning off zero force
teaching
31 FreeDriver Robot in zero force teaching
32 RobotHolding Robot pause
33 StandBy Robot ready
34 ScriptRunning Script running
35 ScriptHoldHandling The script is pending processing
36 ScriptHolding Script pause
37 ScriptStopping Script stopping
38 ScriptStopped Script stopped
39 HRAppDisconnected Hrapp component disconnected
40 HRAppError Hrapp part error

4.34 PCS2ACS

Function: Inverse solution, space position to joint position


Format: PCS2ACS,rbtID,PCSPose[6],ACSPos[6], TCP[6], UCS[6],;
Parameter quantity: 25
Successful return:
” PCS2ACS,OK,ACS [6],;”
Fail to return:
” PCS2ACS,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
BasePose[6] double Base coordinates in millimeters
and degrees
ACSPose[6] double Joint position corresponding to
base coordinates, in degrees

32
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

TCP[6] double Tool coordinates


UCS[6] double User coordinates
Example:
PCS2ACS,0,420,0,415,180,0,180, 0,0,90,0,90,0, 0,0,0,0,0,0, 0,0,0,0,0,0,;

4.35 WayPoint

Function: Waypoint movement, which is the upgraded version


interface of movej and movel
Format: WayPoint,rbtID, PCSPose[6],ACSPos[6],tcpname,ucsname,
Velocity, Acceleration,Radius,moveType,IsUseJoint, isSeek, bit,
state,PointGuid,;
Parameter quantity: 21
Successful return:
”WayPoint,OK,;”
Fail to return:
” WayPoint,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
PCSPose[6] double Target spatial coordinates, in
millimeters and degrees
ACSPose[6] double The joint position corresponding to the
target spatial coordinates, in degrees
tcpname string Name of TCP
ucsname string Name of UCS
The maximum speed of the
motion will be multiplied by the
current override to obtain the final
Velocity double
maximum speed
Movej is the angle
The unit of movel is mm
33
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Acceleration of motion
Acceleration double The moveJ unit is the angle ^ 2
The unit of moveL is mm ^ 2
Radius of intersection between points,
Radius double
in mm
0 is moveJ
moveType int
1 is moveL
IsUseJoint int Use joint angle or not
isSeek int Whether to explore
General input bits of the control box, 0
bit int
~7
The value of the general input bit of
state int
the control box to be searched, 0 or 1
The waypoint global variable, which
can be set by the customer, is a string
PointGuid string of numbers and letters. Do not
appear,;Two symbols, otherwise it will
explain the instruction failure
Target location: it is related to pcspose, tcpname and ucsname. The
final target location will be calculated according to these three parameters
Whether to use joint angle: isusejoint. When doing MoveJ
movement, the target position is not acspose, but the result of pcspose,
tcpname and ucsname operations. However, if IsUseJoin is 1, the target
location is ACSPose directly.
WayPoint,0,519.999, 0, 571.999, 180, -1.4000000000000001e-05, -180,0,
0.000114, 90.000225, 0, 89.999904, 0,TCP,Base,50.000000,360.000000,
0.000000,0,0, 0, 0, 0, ,;

4.36 MoveJ

Function: The robot moves to the specified angular coordinate


position

34
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Format: MoveJ,rbtID,J1,J2,J3,J4,J5,J6,;
Parameter quantity: 7
Successful return:
”MoveJ,OK,;”
Fail to return:
” MoveJ,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Axis 1 command position in
J1 double
degrees
Axis 2 command position in
J2 double
degrees
Axis 3 command position in
J3 double
degrees
Axis 4 command position in
J4 double
degrees
Axis 5 command position in
J5 double
degrees
Axis 6 command position in
J6 double
degrees
Example:
MoveJ,0,0,0,90,0,90,0,;

4.37 MoveL

Function: The robot moves in a straight line to the specified spatial


coordinate position

Format: MoveL,rbtID,X,Y,Z,RX,RY,RZ,;
Parameter quantity: 7
Successful return:
35
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

”MoveL,OK,;”
Fail to return:
” MoveL,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
X double X-axis command position in mm
Y double Y-axis command position in mm
Z double Z-axis command position in mm
RX double RX axis command position in
degrees
RY double Ry axis command position in
degrees
RZ double RZ axis command position in
degrees
Example:
MoveL,0,450,0,450,180,0,-180,;
Note: there are singular points in space motion

4.1 ShortJogJ

Function: Angle movement, fixed distance movement (movement


distance 2 degrees)
Format: ShortJogJ,rbtID,AxisID,Derection,;
Parameter quantity: 3
Successful return:
”ShortJogJ,OK,;”
Fail to return:
” ShortJogJ,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
AxisID int Jog axis ID (0-5)

36
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

(0:J1,1:J2,2:J3,3:J4,4:J5,5:J6)
Movement direction: 0 = negative
Derection int
direction;1 = positive;
Example:
ShortJogJ,0,3,1,;

4.2 ShortJogL

Function: Space movement, fixed distance movement (movement


distance: 2 mm for X, y and Z axes, 2 degrees for Rx, ry and RZ axes)
Format: ShortJogL,rbtID,AxisID,Derection,;
Parameter quantity: 3
Successful return:
”ShortJogL,OK,;”
Fail to return:
” ShortJogL,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
Jog axis ID (0-5)
AxisID int
(0:X,1:Y,2:Z,3:RX,4:RY,5:RZ)
Movement direction: 0 = negative
Derection int
direction;1 = positive;
Example:
ShortJogL,0,3,1,;

4.3 PauseScript

Function: Pause running script


Format: PauseScript,;
Parameter quantity: 0

37
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Successful return:
”PauseScript,OK,;”
Failure Return:
” PauseScript,Fail,ErrorCode,;”, error types see the error code list
Example:
PauseScript,;

4.4 ContinusScript

Function: Continue running script


Format: ContinusScript,;
Parameter quantity: 0
Successful return:
”ContinusScript,OK,;”
Failure Return:
” ContinusScript,Fail,ErrorCode,;”, error types see the error code list
Example:
ContinusScript,;

4.5 StartScript

Function: Start script


Format: StartScript,;
Parameter quantity: 0
Successful return:
”StartScript,OK,;”
Failure Return:
” StartScript,Fail,ErrorCode,;”, error types see the error code list

4.6 RunFunc

Function: Run script


Format: RunFunc,FuncName,param1,…,paramN,;

38
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Parameter quantity: 1+N


Successful return:
”RunFunc,OK,FuncName,;”
Failure Return:
” RunFunc,Fail,ErrorCode,;”, error types see the error code list
Parameter name Type Meaning
A function written in a script
FuncName string
cannot be func_main
Parameters passed in by the
param[1~N] string
customer
Example:
Func_test is written。Send command:
RunFunc,Func_test,1,ijisdf,3,4,;
In CC_Client.params passes in four variable values: 1, ijisdf, 3 and 4, and is of STR
type.You can use the following in the script block

4.7 StopScript

Function: Stop script


Format: StopScript ,;
Parameter quantity: 0
Successful return:
” StopScript,OK,;”
Failure Return:

39
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

” StopScript,Fail,ErrorCode,;”, error types see the error code list

4.8 StartPushMovePath

Function: Add trajectory for movepath


Format: StartPushMovePath, rbtID,tracjectName,override,radius,;
Parameter quantity: 4
Successful return:
” StartPushMovePath,OK,;”
Failure Return:
” StartPushMovePath,Fail,ErrorCode,;”, error types see the error
code list
Parameter name Type Meaning
rbtID int Robot index, count from zero
tracjectName string Trajectory name
Set the speed ratio in the
Override double range of 0.01 ~ 1 (1% ~ 100%)

Blend radius between points, in


radius double
degrees

4.9 PushMovePathJ

Function: Add the points of the trajectory for Movepath


Format: PushMovePathJ, rbtID,tracjectName, J1,J2,J3,J4,J5,J6,;
Parameter quantity: 8
Successful return:
” PushMovePathJ,OK,;”
Failure Return:
” PushMovePathJ,Fail,ErrorCode,;”, error types see the error code
list
Parameter name Type Meaning

40
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

rbtID int Robot index, count from zero


tracjectName string Trajectory Name
J1 double Axis 1 command position in degrees
J2 double Axis 2 command position in degrees
J3 double Axis 3 command position in degrees
J4 double Axis 4 command position in degrees
J5 double Axis 5 command position in degrees
J6 double Axis 6 command position in degrees

4.1 PushMovePathL

Function: Add the point of the trajectory for movepath


Format: PushMovePathL, rbtID,tracjectName, X,Y,Z,RX,RY,RZ,
X_UCS,Y_UCS,Z_UCS,RX_UCS,RY_UCS,RZ_UCS,
X_TCP,Y_TCP,Z_TCP,RX_TCP,RY_TCP,RZ_TCP,;
Parameter quantity: 8
Successful return:
” PushMovePathL,OK,;”
Failure Return:
” PushMovePathL,Fail,ErrorCode,;”, error types see the error code
list
Parameter name Type Meaning
rbtID int Robot index, count from zero
tracjectName string X-axis position in mm
X double Y-axis position in mm
Y double Z-axis position in mm
Z double RX axis position in degrees
RX double Ry axis position in degrees
RY double RZ axis position in degrees
RZ double The x-axis position of the UCS, in
millimeters
X_UCS double Y-axis position of UCS, unit: mm
Y_UCS double Z-axis position of UCS in mm

41
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Z_UCS double RX axis position of UCS in


degrees
RX_UCS double Ry axis position of UCS, in
degrees
RY_UCS double RZ axis position of UCS in
degrees
RZ_UCS double X-axis position of TCP, unit: mm
X_TCP double Y-axis position of TCP, unit: mm
Y_TCP double Z-axis position of TCP, unit: mm
Z_TCP double RX axis position of TCP in
degrees
RX_TCP double Ry axis position of TCP in degrees
RY_TCP double RZ axis position of TCP in degrees
RZ_TCP double X-axis position in mm

4.2 EndPushMovePath

Function: End adding point of trajectory of MovePath


Format: EndPushMovePath, rbtID,tracjectName,;
Parameter quantity: 2
Successful return:
”EndPushMovePath,OK,;”
Failure Return:
” EndPushMovePath,Fail,ErrorCode,;”, error types see the error
code list
Parameter name Type Meaning
rbtID int Robot index, count from zero
tracjectName string Trajectory Name

42
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

4.3 MovePath

Function: Run MovePath trajectory


Format: MovePath, rbtID,tracjectName,;
Parameter quantity: 2
Successful return:
”MovePath,OK,;”
Failure Return:
” MovePath,Fail,ErrorCode,;”, error types see the error code list
Parameter name Type Meaning
rbtID int Robot index, count from zero
tracjectName string Trajectory name

4.4 ReadMovePathState

Function: Read MovePath trajectory status


Format: ReadMovePathState, rbtID,tracjectName,;
Parameter quantity: 2
Successful return:
”ReadMovePathState,OK,State,;”
Failure Return:
”ReadMovePathState,Fail,ErrorCode,;”, error types see the error
code list
Parameter name Type Meaning
rbtID int Robot index, count from zero
tracjectName string Trajectory name
State int The state of the trajectory. The
movepath motion can be called
only after the calculation is
completed
enum EN_MovePathState
{
enMovePathState_Notteach = 0, / / the trajectory is not taught
43
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

enMovePathState_Teaching, / / trajectory Teaching


enMovePathState_Calculating, / / trajectory calculation in progress
enMovePathState_Finish, / / trajectory calculation is completed
enMovePathState_Endteach, / / trajectory completion teaching
enMovePathState_Calculateerror / / trajectory calculation error
};

4.5 StartServo

Function: Start the robot online control (servoj or servop) and set the
cycle and look ahead time of fixed position update
Format: StartServo,rbtID,servoTime,lookaheadTime,;
Parameter quantity: 3
Successful return:
”StartServo,OK,;”
Fail to return:
” StartServo,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
servoTime double The period of fixed position
update is recommended to be
larger than 0.015s
lookaheadTime double The forward-looking time is
recommended to be between 0.05s
and 0.2S

4.6 PushServoj

Function: Online joint position command control, send the joint


position with the fixed update time set by startservo, and the robot will
track the joint position command in real time

44
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Note: The user needs to input the continuous track position. If the
position is not updated after more than 2 update cycles, the line control
will be turned off.
Format: PushServoJ,rbtID,jointPosition [6],;
Parameter quantity: 7
Successful return:
”PushServoJ,OK,;”
Fail to return:
” PushServoJ,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning
rbtID int Robot index, count from zero
jointPosition [6] double Command position of J1 ~ J6 axis,
in degrees

4.7 PushServoP

Function: The online end TCP position command control sends the
TCP position with the fixed update time set by startservo, and the robot
converts the joint position command after real-time tracking target TCP
position inverse operation
Note: the user needs to input the continuous track position. If the
position is not updated after more than 2 update cycles, the line control
will be turned off.
Format: PushServoP,rbtID, PCSPose[6], UCS[6],TCP[6],;
Parameter quantity: 19
Successful return:
”PushServoP,OK,;”
Fail to return:
” PushServoP,Fail,ErrorCode,;”, error types see the error code list
Parameter detail:
Parameter name Type Meaning

45
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

rbtID int Robot index, count from zero


PCSPose[6] double Target spatial coordinates, in
millimeters and degrees
UCS[6] double User coordinates
TCP[6] double Tool coordinates

46
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

5 Datasheet service

5.1 Contents

Datasheet is robot data in JSON format, which contains data such as position and
status. JSON is as follows:
{
"PosAndVel":{"Actual_Position":["0.000","0.000","90.000","0.000","0.000","0.000",
"-55.001","0.000","-28.001","0.000","-90.000","-0.000"],
"Actual_PCS_TCP":["575.000","0.000","600.000","0.000","90.000","0.000"],
"Actual_PCS_Base":["575.000","0.000","600.000","0.000","90.000","-0.000"],
"Actual_PCS_Tool":["0.000","0.000","0.000","0.000","0.000","0.000"],
"Actual_Override":"0.010"
},
"EndIO":{"EndDI":[0,0,0,0],
"EndDO":[0,0,0,0],
"EndButton":[0,0,0,0],
"EndAI":[0.00,0.00]
},
"ElectricBoxIO":{"BoxCI":[0,0,0,0,0,0,0,0],
"BoxCO":[0,0,0,0,0,0,0,0],
"BoxDI":[0,0,0,0,0,0,0,0],
"BoxDO":[0,0,0,0,0,0,0,0]
},
"ElectricBoxAnalogIO":{"BoxAnalogOutMode_1":0,
"BoxAnalogOutMode_2":0,
"BoxAnalogOut_1":"0.00",
"BoxAnalogOut_2":"0.00",
"BoxAnalogIn_1":"-12.50",
"BoxAnalogIn_2":"-12.50"
},
"StateAndError":{"robotState":33,

47
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

"Error_AxisID":0,
"Error_Code":0,
"nResetSafeSpace":[1],
"nAxisGroupStatus":[1],
"nAxisGroupErrorCode":[0],
"nAxisStatus":[3,3,3,3,3,3],
"nAxisErrorCode":[0,0,0,0,0,0]
},
"HardLoad":{"EtherCAT_TotalFrame":0,
"EtherCAT_FramesPerSecond":0,
"EtherCAT_TotalLostFrame":0,
"EtherCAT_TxErrorFrame":0,
"EtherCAT_RxErrorFrame":0,
"Box48IN_Voltage":0.00,
"Box48IN_Current":0.00,
"Box48Out_Voltage":47.98,
"Box48Out_Current":0.00,
"Slave_temperature":[0.00,0.00,0.00],
"Slave_Voltage":[0.00,0.00,0.00]
},
"FTData":{"FTData":[0.00,0.00,0.00,0.00,0.00,0.00],
"FTSrcData":[0.00,0.00,0.00,0.00,0.00,0.00]
},
"realtimeKey_Script":{"cmdid":["6DA4B648930B1F453EAD4201BB4E7F76","","",
"","",""], "GlobalVar":[{"test":"0"},{"yy":"0,0,0,0,0,0"}],
"errorCode":0 }
}

5.2 Headers

Datasheet data has the following header


4BYTE Total length (Headers + Data length 4byte Data(json)
data) 4byte
RBTL

48
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

49
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

6 Control robot movement process –


example

6.1 Motion flow chart

When the robot is successfully enabled, the robot can move to the
target position by sending move series commands and long and short jog
commands. There are the following points to pay attention to when
sending motion commands:
1. Only when the current motion command of the robot is successfully
completed can the next motion command be issued (the current motion
state of the robot can be obtained by sending the command
"readrobotstate" to obtain the motion state of the robot).
2. When the call to obtain the robot motion state command returns that
the motion state is in motion, the upper computer should call the
command to obtain the robot motion state repeatedly until the robot
motion state indicates that the motion is completed or the motion is
wrong.
3. When the control system returns the robot motion error, the upper
computer should call grpseset command to clear the error of the control
system. Only when the error is cleared successfully can the next motion
command be called.
4. If the control system returns to the completion of robot motion, it can
continue to issue the next motion command, and then repeat 2-4.
The specific process is shown in the figure below:

50
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

Robot motion flow chart

6.2 Code sample

The pseudo code is as follows for reference only:


// Wait for the movement to complete
int WaitMotionFinish()
{
while(1)
{
// 1. Send and obtain robot motion status message: ReadRobotState,;

// 2. Parse the returned motion state: MoveState

51
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface

if(movingState == 1)
{
// In motion, wait 10 milliseconds and query again
Sleep(10);
}
else if(movingState == 0)
{
// When the motion is completed, return to 0 directly
return 0;
}
else
{
// Handle other errors separately
return nErrCode;
}
}
return 0;
}

52

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