HansRobotV5 Communication Protocol(Linux)English(1)
HansRobotV5 Communication Protocol(Linux)English(1)
HansRobotV5
Communication Protocol Interface
1、Edit History:
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
1 INTERFACE PREVIEW....................................................................................................... 1
2 INTRODUCTION...................................................................................................................4
2.1 OVERVIEW.........................................................................................................................4
2.3 GLOSSARY.........................................................................................................................5
3 SYSTEM STRUCTURE.........................................................................................................6
3.1.1 As Client....................................................................................................................... 6
3.1.2 As Server.......................................................................................................................6
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
1 Interface Preview
Interface Description
control box
of control box
1
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
control box
control box
position
2
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
StartServo Set the fixed update cycle and look-ahead time when
in real time.
3
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
2 Introduction
2.1 Overview
(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
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.
3.1.1 As Client
3.1.2 As Server
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.
7
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
8
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
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
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
Fail to return:
” Electrify,Fail,ErrorCode,;”, error types see the error code list
Example
Electrify,;
4.2 BlackOut
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
Fail to return:
”StartMaster,Fail,ErrorCode,;”, error types see the error code list
Example:
StartMaster,;
4.4 CloseMaster
4.5 GrpPowerOn
Example
GrpPowerOn,0,;
4.6 GrpPowerOff
4.7 GrpStop
GrpStop,0,;
4.8 GrpReset
4.9 GrpInterrupt
4.10 GrpContinue
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
4.12 GrpCloseFreeDriver
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
4.16 SetEndDO
18
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.17 SetBoxDO
SetBoxDO,1,1,;
4.18 SetBoxCO
4.19 SetBoxAO
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
4.21 ReadEI
21
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.22 ReadEO
Example:
ReadEndDO,0,1,;
4.23 ReadEAI
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
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
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
4.30 ReadActPos
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
4.31 ReadOverride
4.32 ReadRobotState
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
30
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
31
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.34 PCS2ACS
32
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.35 WayPoint
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
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
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
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
4.3 PauseScript
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
4.5 StartScript
4.6 RunFunc
38
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.7 StopScript
39
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.8 StartPushMovePath
4.9 PushMovePathJ
40
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.1 PushMovePathL
41
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.2 EndPushMovePath
42
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
4.3 MovePath
4.4 ReadMovePathState
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
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
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
48
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
49
Shenzhen Han’s Robot Co.,Ltd. HansRobot Communication Protocol Interface
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
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