Professional Documents
Culture Documents
Robot Division
Kawasaki Heavy Industries, Ltd.
2021/07/05
Rev: DEV 2.3.0
Document No: 90210-1416DEC
About
This document is a manual for KRNX(Kawasaki Robot Network eXtension) API. This
document describes KRNX’s concept, usage, and data structure. KRNX is available for
OpenAS E controller and F controller.
This document does not describe robot operation and AS Language usage. If you want,
please refer “Operation Manual” and “AS Language Reference Manual”.
Please understand the robot motion control fully and use KRNX carefully.
This document describes the function of KRNX library version “DEV 2.3.0”. If you use the
older one, you cannot use some functions.
1
Revision History
2
Rev: DEV 2.1.0 Update (2020/04/27)
Section Note
2, 3, 4 Devide AUX-API into “Common API”, “AUX-API”, “AS-API”
3 Add “krnx_SetAuxApiTimeoutPeriod” in AUX-API
4 Add “krnx_SetAsApiTimeoutPeriod” in AS-API
3
SYMBOLS
The items that require special attention in this manual are designated with the
following symbols.
Ensure proper and safe operation of the robot and prevent physical injury or
property damage by complying with the safety matters given within the boxes
with these symbols.
DANGER
Failure to comply with indicated matters can result in
imminent injury or death.
WARNING
CAUTION
Important
4
WARNING
1. The accuracy and effectiveness of the diagrams, procedures, and detail
explanations given in this manual cannot be confirmed with absolute
certainty. Should any unexplained questions or problems arise, please
contact Kawasaki Robot Service.
2. Safety related contents described in this manual apply to each individual
work and not to all robot work. In order to perform every work in
safety, read and fully understand the safety manual, all pertinent laws,
regulations and related materials as well as all the safety explanation
described in each chapter, and prepare safety measures suitable for
actual work.
! CAUTION
This manual is for explanation of KRNX functions, and does not
ensure application system using KRNX. We don’t take responsibility
for any damage by the application system. We don’t also take
responsibility for any trouble about any patents.
This manual is subject to change without notice for modification and
improvement.
No part of this manual may be reproduced in any form without
permission.
This manual is published under strict quality control standards.
Should you notice any errors or other problems, please feel free to
contact us about them.
5
Contents
1 Abstract................................................................................................................... 9
1.1 Functions ........................................................................................................................ 9
1.2 AUX-API ......................................................................................................................... 9
1.3 AS-API .......................................................................................................................... 10
1.4 RT-API .......................................................................................................................... 11
1.5 Matrix-API .................................................................................................................... 12
1.6 Controller Number and Robot Number .................................................................... 13
2 Supported System .................................................................................................. 15
2.1 Supported library environment ...................................................................................... 15
2.2 Supported Controllers and Robot arms.......................................................................... 15
3 Common API ....................................................................................................... 19
3.1 Connect to Robot Controller ...................................................................................... 19
3.2 Disconnect from Robot Controller ............................................................................ 20
4 AUX-API ............................................................................................................... 21
4.1 Abort Robot Program ................................................................................................. 21
4.2 Hold Robot Program ................................................................................................... 22
4.3 Continue Robot Program ........................................................................................... 23
4.4 Execute Robot Program ............................................................................................ 24
4.5 Kill Robot Program...................................................................................................... 25
4.6 Set Monitor Speed ...................................................................................................... 26
4.7 Abort PC Program ...................................................................................................... 27
4.8 Finish PC program ...................................................................................................... 28
4.9 Continue PC Program ................................................................................................ 29
4.10 Execute PC Program.................................................................................................. 30
4.11 Kill PC Program ........................................................................................................... 31
4.12 Get Base Matrix............................................................................................................. 32
4.13 Set Base Matrix ............................................................................................................. 33
4.14 Get Tool Matrix ............................................................................................................. 34
4.15 Set Tool Matrix ............................................................................................................. 35
4.16 Get Input / Output signal ............................................................................................ 36
4.17 Set Output Signal ........................................................................................................ 37
4.18 Reset External Output Signals(Monitor Command) ......................................... 38
4.19 Delete Data(Monitor Command) ......................................................................... 39
4.20 List program and data ................................................................................................ 40
4.21 Error Reset................................................................................................................... 41
4.22 Execute Program Instruction ..................................................................................... 42
4.23 Prime Program ............................................................................................................ 43
4.24 Record Program .......................................................................................................... 44
4.25 Execute Monitor .......................................................................................................... 45
4.26 Set AUX-API Timeout Period .................................................................................... 46
5 AS-API .................................................................................................................. 48
5.1 Get Robot Name ............................................................................................................ 48
5.2 Get Axis Working Limit ............................................................................................... 49
5.3 Get IO Information ...................................................................................................... 50
5.4 Get Program Status Information ............................................................................... 51
5.5 Get Control Panel Information .................................................................................. 52
5.6 Get Error Code ............................................................................................................ 53
5.7 Convert Error Code .................................................................................................... 54
5.8 Get/Set RTC Information ........................................................................................... 55
5.9 Set AS-API Timeout Period ....................................................................................... 56
6 RT-API .................................................................................................................. 58
6.1 Set RT Cyclic Data Kind ............................................................................................... 58
6.2 Get RT Cyclic Data Kind .............................................................................................. 60
6.3 Get Current Motion Data ............................................................................................... 61
6.4 Get Current Motion Data (Extended) ............................................................................ 62
6.5 Get IO Information (Extended) .................................................................................. 63
6.6 Set RTC Complement Data....................................................................................... 64
6
6.7 Get RTC Complement Data ...................................................................................... 66
6.8 Clear Old RTC Complement Data ............................................................................ 67
6.9 Get RTC Complement Data Limit ............................................................................. 68
6.10 Set RTC Error Flag ..................................................................................................... 69
6.11 Get RTC Error Flag .................................................................................................... 70
6.12 Get RTC Switch .......................................................................................................... 71
6.13 Get RTC Complement Data Buffer Length ............................................................. 72
6.14 Get Current Error Lamp Asynchronously ................................................................... 73
6.15 Get Current Error Code Asynchronously ................................................................ 74
6.16 Prime RTC Complement Data .................................................................................. 75
6.17 Send RTC Complement Data ................................................................................... 77
6.18 Mask RTC Complement Data ................................................................................... 79
7 Matrix API ............................................................................................................. 81
7.1 Joint to XYZOAT/Matrix ............................................................................................. 81
7.2 XYZOAT/Matrix to Joint ............................................................................................. 82
7.3 Multiply XYZOAT/Matrix ............................................................................................ 84
7.4 Inverse XYZOAT/Matrix .............................................................................................. 85
7.5 Transform XYZOAT/Matrix ......................................................................................... 86
7.6 Calculate Frame Coordinates......................................................................................... 87
8 Internal API ........................................................................................................... 89
8.1 Get KRNX Version ....................................................................................................... 89
9 Dara Structure ........................................................................................................ 91
9.1 Transformation Values (XYZOAT) ........................................................................... 91
9.2 Transformation Matrix ................................................................................................ 91
9.3 TKrnxIoInfo .................................................................................................................. 92
9.4 TKrnxIoInfoEx .............................................................................................................. 93
9.5 TKrnxPanelInfo ........................................................................................................... 95
9.6 TKrnxProgramInfo ...................................................................................................... 96
9.7 TKrnxCurMotionData.................................................................................................. 98
9.8 TKrnxCurMotionDataEx ............................................................................................. 99
9.9 TKrnxRtcInfo .............................................................................................................. 100
10 RTC Function ............................................................................................... 101
10.1 About ........................................................................................................................... 101
10.2 Procedure ..................................................................................................................... 101
10.2.1. Preparation of Robot Program for RTC Function ............................................... 102
10.2.2. Preparation of Robot Program for RTC Function (If RTC_CTL is not supported)102
10.2.3. Configuration of RTC Information ..................................................................... 103
10.2.4. Execution of Robot Program and Handling States .............................................. 103
10.2.5. Sending RTC Complement Data ......................................................................... 105
10.2.6. Getting RTC Control Data .................................................................................. 105
10.2.7. Synchronization with AS control cycle ............................................................... 105
10.2.8. Sequence about RTC Function............................................................................ 107
10.2.9. Restrictions about RTC function ......................................................................... 109
11 Thread-safety and Reentrancy of API .......................................................... 112
12 Error Code .................................................................................................. 113
13 Related File ................................................................................................ 118
13.1 Header File ................................................................................................................ 118
13.2 Port Files .................................................................................................................... 118
14 Example ...................................................................................................... 120
Appendix. A:AS Language .................................................................................. 121
A.1 RTC_SW .................................................................................................................... 121
A.2 RTC_STATUS ........................................................................................................... 122
A.3 RTC_CTL ................................................................................................................... 122
A.4 KRNX_RTC ............................................................................................................... 122
A.5 KRNX_RTC_INFO .................................................................................................... 123
Appendix. B:API List............................................................................................. 125
7
Memo
8
1 Abstract
1 Abstract
1.1 Functions
User application on PC can communicate to Robot Controller with KRNX.
KRNX has the following functions.
- Robot Program Control (Abort, Hold, Continue, Execute, Stop, SetMonSpeed)
- PC Program Control (Abort, End, Continue, Execute, Stop)
- Program Execution Status Acquisition
- Robot Real time Position Acquisition ( Angle, Current, Encorder)
- Signal Control (Set, Get, Reset)
- Program Edit
- Axis Conversion
- AS Monitor Command
1.2 AUX-API
AUX-API links AS Language monitor command. User program can connect to AS and AS
User program with KRNX
Controller
User AS
Program User Program
AS-API
AUX-API AS To Servo Unit
User program can get robot information (ex. robot status) with AUX-API.
Because behavior of robot is written with AS user program, AS user program can use usual AS
Language while using AUX-API.
For the detail of AS Language, please refer to AS Language Manual.
! WARNING
9
1 Abstract
1.3 AS-API
AS-API links AS. AS-API can control Robot behavior. AS-API can get IO information, AS
User Program information, and etc. AS-API can get these information faster than AUX-API.
(About 10~100 msec).
Controller
User AS
Program User Program
! WARNING
10
1 Abstract
1.4 RT-API
RT-API links AS. RTC (Real Time Correction) function can add RTC value to joint angles
per 2 msec. User program have to calculate RTC value par specified cycle. User program
can use RTC Function by using RT-API. RT-API can also get robot’s current joint angles par
2 msec.
Controller
User AS
Program User Program
RT-API AS
RTC Function only works in REPEAT mode. RTC Function is enabled if AS user program
use RTC command (refer to “Appendix. A:AS Language”).
! WARNING
Incorrect RTC value may possibly leads to robot’s unexpected
behavior.
! CAUTION
To use RTC function, Robot controller needs to support RTC
function.
11
1 Abstract
1.5 Matrix-API
Matrix-API calculate kinematics of robot arm. Using Matrix-API, user program can get
matrix about kinematics and inverse kinematics.
12
1 Abstract
If you use only one Robot Controller, the Controller Number equals 0, and the Robot Number
equals 0. If you specified an incorrect controller number, APIs related to Controller return error
number. If you specified an incorrect robot number, APIs related to Robot Arm return error
number.
13
1 Abstract
Memo
14
2 Supported System
2 Supported System
2.1 Supported library environment
KRNX supports these library environment
E-Controller Internal
F-Controller Internal
Windows 32bit/64bit
Windows 7/10
Linux 32bit/64bit
Ubuntu 16.04/18.04
Supported robot arms are different from API kind in KRNX. AUX-API/AS-API support all robot
arms. RT-API/Matrix-API support robot arms as below. The robot controller which KRNX
connects to is also needed to support the robot arms.
RA005L-A001
RA006L-A001
RA010N-A001
RA010L-A001
RA020N-A001
RD080N-A001
M series MX350L-A001 ✓ ✓
MX400N-A001
MX420L-A001
MX500N-A001
MC004N-A001/B001
MS005N-B001 ✓ -
K series KF121J/U-A001/B001/C001 ✓ ✓
KF121J-B001/C001
KF192-A001/B001
15
2 Supported System
KF193-A001
KF194-A001
KF262-A001/B001/S001/T0001
KF263-A001
KF264-A001
KH214-A001
KH264-A001
KT264-B001/C001
KJ125-A001/B001
KJ155-A001/B001/C001/D001
KJ194-A001/B001
KJ244-C001/D001
KJ264-A001/B001/S001/S002
KJ294-A001/B001
KG264-A001
KG284-B001
KD010-B001/B002
KLS400-03N
KLS600-06N
KF194-A001 - ✓
CP series CP180L-A001 ✓ ✓
B series BX100N-B001 ✓ ✓
BX100S-B011
BX130X-B001/C001
BX200L-A001/B001/C001
BX200X-C001
BX100L-B001/B011 - ✓
BX130X-B011
BX165N-B001
BX200L-B011
BX250L-B001
BX300L-B001
BT200L-A001
W series WD002N-A202L/A202U ✓ ✓
(duAro)
N series NC005N-A001 ✓ -
NC008-A001
JS series JS002-A001, JS005-E001 ✓ ✓
JS010-C001
U series UX120-E001 ✓ ✓
UB150-A003
UA100-D001 - ✓
F series FS006N-A001/B001 ✓ ✓
FS006L-A001/B001
FS010N-A001/B001
FS010E-A001/B001
FS010L-A001
FS010C-A001/B001
FS010X-A001
FS020N-A001
16
2 Supported System
FS020C-A001
FS020X-A001
FS030N-A001
FS030L-A001
FS045N-A001/B001
FS045C-A001
FS060L-C001
FS002N-A001/B001
FS003N-A001
FS003N-E001
FS003N-F001
FW003N-E001
FW003N-G001
FA006N-B001
FA006E-B001
FA006L-B001
FA010N-B001
FA010L-A001
FA020N-A001
FA030L-A001
FD050N-C001
FT020N-C001
FA006N-A001 - ✓
FA010N-A001
Z series ZT130S-B001/C001 ✓ ✓
ZT130U-C001
ZT165U-C001
ZT200S-B001/C001
ZT200U-C001
ZX130S-A001/B001/T001
ZX130L-B001
ZX130U-B001
ZX165L-B001/BS01
ZX165U-B001/BS01/T001
ZX165X-A001
ZX200S-A001/B001/S001/BS01
ZX200U- B001
ZX300S-A001/B001
ZD130S-A001/C001/D001/E001
ZD250S-A001/B001
ZS100U-A001/T001
ZH100U-A001
ZB150S-A001/B001/T001
ZX165S-T001 ✓ -
Others CMH01N-A001 ✓ ✓
KMO000-A001/C001
KMY000-A001
HGO000-A001/B001
17
2 Supported System
SR010-A001
SR010N-C004
SR030-C007
SR035-B001
SR070-D003
GFSW000-A001
OFSW000-A001
SR030H-B001 - ✓
HR050N-A001
18
3 Common API
3 Common API
3.1 Connect to Robot Controller
int krnx_Open(
int cont_no,
char *hostname
)
Parameters
cont_no
Controller number
hostname
IP address or hostname of the controller
Returns
cont_no : Connected controller number
Negative value : Error code (refer to “12 Error Code” )
Description
Connect to robot controller. After you call this API, you can use other APIs.
See also
krnx_Close
19
3 Common API
Parameters
cont_no
Controller number
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code” )
Description
Disconnect from robot controller. After you call this API, you cannot use other APIs.
See also
krnx_Open
20
4 AUX-API
4 AUX-API
4.1 Abort Robot Program
int krnx_Abort(
int cont_no
int robot_no
int *as_err_code
)
Parameters
cont_no
Controller number
robot_no
Robot number
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code” )
Description
Abort robot program.
After the current step of robot program was finished, this API aborts the robot
program.
The robot program can be restarted by krnx_Continue.
See also
krnx_Excute, krnx_Hold, krnx_Continue
21
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Hold robot program.
This API holds robot program immediately even if the current step of robot program
was not finished.
Motor power is not turned off.
The robot program can be restarted by krnx_Continue.
See also
krnx_Continue, krnx_Abort
22
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
next
0 : Continue from the stopped step.
1 : Continue from the stopped next step
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code(refer to “12 Error Code”)
Description
Continue the robot program stopped by krnx_Abort, krnx_Hold or AS error.
See also
krnx_Hold, krnx_Abort
23
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
program
Program name
exec_num
Number of execution
Negative value : unlimited
0 : One
1 – 32768 : Number of execution
step_num
Start step number.
0 : Execute from the executable of the program.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Execute the specified robot program. The program will be executed from the
specified number step and repeated for the specified number.
See also
krnx_Hold, krnx_Abort, krnx_Kill, krnx_Continue
24
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Initialize the stack for robot program.
See also
krnx_Execute, krnx_Abort
25
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
speed
Monitor speed (%)
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set monitor speed. The robot speed is specified by the multiple of this API value
and the program speed.
See also
26
4 AUX-API
Parameters
cont_no
Controller number
pcprogram_no
PC program number (1 – 3)
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Abort PC program.
The PC program can be restared by krnx_PcContinue.
See also
krnx_PcContinue
27
4 AUX-API
Parameters
cont_no
Controller number
pcprogram_no
PC program number (1 - 3)
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
If current PC program execute STOP instruction, the PC program will be stopped.
If the execution number is not 0, the stopped PC program will be started by
krnx_PcContinue.
See also
krnx_PcContinue
28
4 AUX-API
Parameters
cont_no
Controller number
pcprogram_no
PC program number (1 – 3)
next
0 : Continue from the stopped step.
1 : Continue from the stopped next step
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Continue the PC program that was stopped by krnx_PcAbort, krnx_PcEnd .
See also
krnx_PcAbort, krnx_PcEnd
29
4 AUX-API
Parameters
cont_no
Controller number
pcprogram_no
PC program number (1 – 3)
program
PC program name
exec_num
Number of execution
Negative value : unlimited
0 : One
1 – 32768 : number of execution
step_num
Start step number.
0 : Execute from the executable of the program.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Execute the PC program.
See also
krnx_PcAbort, krnx_PcEnd, krnx_PcKill
30
4 AUX-API
Parameters
cont_no
Controller number
pcprogram_no
PC program number (1 – 3)
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Initialize the stack for the PC program.
See also
krnx_PcExecute, krnx_PcAbort
31
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
xyzoat
Address of current base transformation values
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get current base transformation values (X, Y, Z, O, A, and T).
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
See also
krnx_SetBaseMatrix、krnx_GetToolMatrix、krnx_SetToolMatrix
32
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
xyzoat
Address of current base transformation values
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set current base transformation values (X, Y, Z, O, A, and T).
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
See also
krnx_GetBaseMatrix、krnx_GetToolMatrix、krnx_SetToolMatrix
33
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
xyzoat
Address of current tool transformation values
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get current tool transformation values (X, Y, Z, O, A, and T).
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
Tool transformation values define the relative position and direction from tool
attached flange.
See also
krnx_SetToolMatrix、krnx_GetBaseMatrix、krnx_SetBaseMatrix
34
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
xyzoat
Address of current tool transformation values
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set current tool transformation values (X, Y, Z, O, A, and T).
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
Tool transformation values define the relative position and direction from tool
attached flange.
See also
krnx_GetToolMatrix、krnx_GetBaseMatrix、krnx_SetBaseMatrix
35
4 AUX-API
Parameters
cont_no
Controller number
signal_no
Output singal (1 - 960), input signal (1001 – 1960), internal signal(2001-2960)
status
Address of signal status buffer
1 : ON
0 : OFF
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get the ON/OFF status of signal specified by signal_no.
Please allocate over 4 bytes area for status.
See also
krnx_SetSignal
36
4 AUX-API
Parameters
cont_no
Controller number
signal_no
Output singal (1 - 960), internal signal(2001-2960)
status
Signal Status
-1 : ON
0 : OFF.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set ON/OFF status of signal specified by signal_no.
See also
krnx_GetSignal, krnx_Reset
37
4 AUX-API
Parameters
cont_no
Controller number
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set OFF to all of external output signals.
See also
krnx_SetSignal
38
4 AUX-API
Parameters
cont_no
Controller number
element_name
Delete target data name
If “*” is set, all of data included in element_type are deleted.
element_type
Delete target data type. (refer to the below table)
Multiple macros can be set by “OR” operation.
Macro Description
QUAL_PRG Program
QUAL_LOC Position Information
QUAL_REAL Real Variable
QUAL_STR String Variable
QUAL_INT Integer Variable
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”) Description
Delete the specified data from system memory.
When element_type is 0, the specified program and all of subroutine, variables
used by the program will be deleted. But the subroutine and variables used by the
other program will not be deleted.
When element_type is QUAL_PRG, the specified program will be deleted.
The subroutine, variables used by the program will not be deleted.
See also
39
4 AUX-API
Parameters
cont_no
Controller number
element_name
Specify output data. If NULL is specified, all of data will become target.
element_type
Specify the data type. The values are same as that of krnx_Delete.
buffer
Address of output buffer.
buffer_sz
Size of output buffer
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Write specified program or data to output buffer as text data.
See also
krnx_Delete
40
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Reset error for the robot. This API function is same as “Reset” switch of control
panel.
See also
41
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
cmd
Program instruction
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Execute the robot program instruction specified by “cmd”.
See also
42
4 AUX-API
Parameters
cont_no
Controller number
robot_no
Robot number
program
Program name
exec_num
The number of program execution
step_num
Execution start step number
create
Non-zero : Create new program if the program is not exist on the memory.
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Prime the robot program for execution.
After calling krnx_Prime, please call krnx_Continue to execute the program.
If the program is not exist on memory and you call this function with non-zero create
parameter, the program will be created.
The new generated program does not have any instruction, but you can add a step
by krnx_RecOneStep.
See also
krnx_RecOneStep, krnx_Execute, krnx_Continue
43
4 AUX-API
Parameters
cont_no
Controller number
program
Program name
step_num
Execution start step number
step_data
Program instruction
insert
Non-zero : insert the step
0 : Overwrite the step
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Add a new step into the specified program.
See also
krnx_Prime
44
4 AUX-API
Parameters
cont_no
Controller number
cmd
Monitor command
buffer
Address of output buffer
buffer_sz
Size of output buffer
as_err_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Execute monitor command and get the result from robot controller.
See also
45
4 AUX-API
Parameters
cont_no
Controller number
period
Timeout period
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code” )
Description
Set timeout period (msec) for AUX-API. Each AUX-API returns KRNX_E_TIMEOUT
if its data send/recv is not finished in this parameter.
Default period is 1000msec. This parameter can be set in each controller number.
See also
46
4 AUX-API
Memo
47
5 AS-API
5 AS-API
5.1 Get Robot Name
int krnx_GetRobotName(
int cont_no,
int robot_no,
char *name
)
Parameters
cont_no
Controller number
robot_no
Robot number
name
Address of robot name
You have to allocate over 26 bytes for the buffer.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Robot name is copied to the specified address.
ex) “FS002-A001”, “FS010-A001”, “FS045-A001”
See also
48
5 AS-API
void krnx_GetLimitP(
int cont_no,
int robot_no,
float *limit_p
)
Parameters
cont_no
Controller number
robot_no
Robot number
limit_m
Address of the lower limit buffer
Unit : mm for Linear / radian for Rotational
You have to allocate over 72 bytes (sizeof(float) x 18) for the buffer.
limit_p
Address of the upper limit buffer
Unit : mm for Linear / radian for Rotational
You have to allocate over 72 bytes (sizeof(float) x 18) for the buffer.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Write the lower / upper limit into the buffer.
limit_m[i] corresponds to lower limit of axis i.
limit_p[i] corresponds to upper limit of axis i.
See also
49
5 AS-API
Parameters
cont_no
Controller number
ip
Address of robot IO information buffer
TKrnxIoInfo struct is defined as below.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get the latest status of external input/output signal and internal signal.
Please refer “TKrnxIoInfo” for more detail.
You can also get IO Information by krnx_GetSignal and krnx_GetCurIoInfoEx
See also
TKrnxIoInfo, krnx_SetSignal, krnx_GetSignal, krnx_GetCurIoInfoEx
50
5 AS-API
Parameters
cont_no
Controller number
robot_no
Robot number
ip
Address of robot program status information buffer.
TKrnxProgramInfo struct is defined as below.
#define KRNX_MAX_ROBOT 8
typedef struct
{
TKrnxMonInfo mon[KRNX_MAX_ROBOT];
TKrnxStepperInfo robot[KRNX_MAX_ROBOT];
TKrnxStepperInfo pc[3];
} TKrnxProgramInfo;
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
mon[] have current value of robot monitor speed, program speed, accuracy.
If controller connects to only one robot, only mon[0] is valid.
robot[] have working condition of robot program.
If controller connects to only one robot, only robot[0] is valid.
pc[] has a condition of PC program. You can execute 3 PC programs maximum at
the same time.
Please refer to 9.6 for TKrnxMonInfo, TKrnxStepperInfo.
See also
TKrnxProgramInfo, TKrnxMonInfo, TKrnxStepperInfo, krnx_SetMonSpeed
51
5 AS-API
Parameters
cont_no
Controller number
robot_no
Robot number
info
Address of coltroll panel information buffer.
TKrnxPanelInfo is defined as below.
typedef struct
{
short error_lamp;
short motor_lamp;
short cyc_lamp;
short repeat_lamp;
short run_lamp;
short trigger_lamp;
short teach_lock_lamp;
short emergency;
} TKrnxPanelInfo;
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get control panel information.
See also
52
5 AS-API
Parameters
cont_no
Controller number
robot_no
Robot number
error_code
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get error code occurred in robot controller. You can convert this code to AS error
level and code by using krnx_ConvertErrorCode.
See also
krnx_ConvertErrorCode
53
5 AS-API
Parameters
error_code
Address of error code buffer (read / write)
error_level
Address of AS error code level buffer ( 2 Bytes)
Returns
Address of controller error code buffer
Refer to AS Language Manual “Error Message” for the robot controller error code.
Description
Convert error code (acquired by krnx_GetErrorInfo, monitor command API) into AS
error level and code. The converted error level and code are correspond to the AS
Language Manual “Error Message”.
See also
krnx_GetErrorInfo
54
5 AS-API
int krnx_GetRtcInfo(
int cont_no,
TKrnxRtcInfo *rtc_info
)
Parameters
cont_no
Controller number
rtc_info
Address of KRNX RTC information buffer
Refer to chapter 5 TKrnxRtcInfo for more information.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get/Set RTC information.
These API are same functions as AS Language “KRNX_RTC”
See also
TKrnxRtcInfo
55
5 AS-API
Parameters
cont_no
Controller number
period
Timeout period
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set timeout period (msec) for AS-API. Each AS-API returns KRNX_E_TIMEOUT if its
data send/recv is not finished in this parameter.
Default period is 100msec. This parameter can be set in each controller number.
See also
56
5 AS-API
Memo
57
6 RT-API
6 RT-API
6.1 Set RT Cyclic Data Kind
int krnx_SetRtCyclicDataKind(
int cont_no,
unsigned short kind,
)
Parameters
cont_no
Controller number
kind
Setting bit for RT Cyclic data kind
Bit map is as below (0: disabled, 1: enabled).
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Set kinds of RT cyclic data. This RT cyclic data is received from AS every 2ms.
By executing this API before krnx_Open, KRNX automatically receives the
specified data per 2ms from AS.
To get the value, use the corresponding APIs.
If AS doesn’t support the specified kinds of data, krnx_Open returns
KRNX_RT_CYCLIC for error.
Default data kinds of RT cyclic data are joint angle present value, joint angle
command value, joint current present value, and error lamp/code.
58
6 RT-API
See also
krnx_GetRtCyclicDataKind
59
6 RT-API
Parameters
cont_no
Controller number
krnx_kind
Address of setting bit for RT cyclic data kind by KRNX side.
Refer to “6.1 Set RT Cyclic Data Kind” for bit map.
as_kind
Address of supporting bit for RT cyclic data kind by AS side.
Refer to “6.1 Set RT Cyclic Data Kind” for bit map.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get kinds of RT cyclic data. This RT cyclic data is received from AS every 2ms.
By KRNX side, krnx_kind gets the setting kind from krnx_SetRtCyclicDataKind.
By AS side, after krnx_Open, as_kind gets the supporting data kind of AS. And
before krnx_Open, as_kind gets the default data kind, joint angle present value, joint
angle command value, joint current present value, and error lamp/code.
See also
krnx_SetRtCyclicDataKind
60
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
md
Address of motion data buffer
TKrnxCurMotionData struct is defined as below.
#define KRNX_MAXAXES 18
typedef struct
{
float ang[KRNX_MAXAXES];
float ang_ref[KRNX_MAXAXES];
float cur[KRNX_MAXAXES];
long enc[KRNX_MAXAXES];
} TKrnxCurMotionData;
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get the latest motion data from controller buffer. Buffered cycle is 2ms.
You can get the data which is selected by krnx_SetRtCyclicDataKind
Refer to “TKrnxCurMotionData” for more detail.
You have to allocate bytes of TKrnxCurMotionData for md.
If md is set NULL, this API returns KRNX_BADARGS.
See also
TKrnxCurMotionData
61
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
md
Address of motion data buffer
TKrnxCurMotionData struct is defined as below.
#define KRNX_MAXAXES 18
typedef struct
{
float ang[KRNX_MAXAXES];
float ang_ref[KRNX_MAXAXES];
float cur[KRNX_MAXAXES];
int enc[KRNX_MAXAXES];
float cur_ref[KRNX_MAXAXES];
float cur_sat[KRNX_MAXAXES];
float cur_sat_ref[KRNX_MAXAXES];
int enc_ref[KRNX_MAXAXES];
float ang_vel[KRNX_MAXAXES];
float ang_vel_ref[KRNX_MAXAXES];
float xyzoat[6];
float xyzoat_ref[6];
float xyzoat_vel;
float xyzoat_vel_ref;
} TKrnxCurMotionDataEx;
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get the latest motion data from controller buffer. Buffered cycle is 2ms.
You can get the data which is selected by krnx_SetRtCyclicDataKind
Refer to “TKrnxCurMotionDataEx” for more detail.
You have to allocate bytes of TKrnxCurMotionDataEx for md.
If md is set NULL, this API returns KRNX_BADARGS.
See also
TKrnxCurMotionDataEx, krnx_SetRtCyclicDataKind, krnx_GetRtCyclicDataKind
62
6 RT-API
Parameters
cont_no
Controller number
ip
Address of robot IO information (Extended) buffer
TKrnxIoInfoEx struct is defined as below.
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get the latest status of external input/output signal and internal signal from
controller buffer. Buffered cycle is 2ms.
You can get the data which is selected by krnx_SetRtCyclicDataKind
Refer to “TKrnxIoInfoEx” for more detail.
You can also get IO information by krnx_GetSignal and krnx_GetCurIoInfo.
See also
TKrnxIoInfoEx, krnx_SetSignal, krnx_GetSignal, krnx_GetCurIoInfo
63
6 RT-API
int krnx_SetRtcCompData(
int cont_no,
int robot_no,
const float *comp,
int *status,
unsigned short seq_no
)
Parameters
cont_no
Controller number
robot_no
Robot number
comp
Address of the RTC Complement data buffer
Unit : mm for Linear / radian for Rotational
status
Address of complement result status buffer.
The description of value is as below.
Value Description
0x0001 Operational area upper limit over
0x0002 Operational area lower limit over
0x0004 RTC Complement data limit over
seq_no
Sequence number
Please set incremented value one by one every time you call this function.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Set RTC complement data into controller. If RTC switch is ON, the robot
moves to (AS each axis position command + complement data) position.
comp[i] is correspond to (i+1)-th axis.
You have to allocate over 72 bytes (18 x sizeof(float)) for the buffer.
If complement data is incorrect, the return value is negative value.
If the sum of axis position command value in AS and RTC complement data is over
the upper limit (lower limit), operational area upper limit (lower limit) error status is
set.
If the difference between previous and current complement data is over the limit
value,
RTC Complement value limit error status is set.
Since AS command value is updated per 2 msec, RTC Complement data should be
sent per specified cycle time by KRNX_RTC and krnx_GetRtcBufferLength.
64
6 RT-API
See also
krnx_PrimeRtcCompData, krnx_SendRtcCompData, krnx_GetRtcCompData,
krnx_GetRtcCompLimit, krnx_GetRtcBufferLengh, krnx_SetRtcInfo, krnx_GetRtcInfo,
_
A.1 RTC_SW, A.4 KRNX_RTC, A.5 KRNX_RTC_INFO (AS Language)
! WARNING
If incorrect complement value is set, the robot may move to
out of working area or too quickly.
Please be careful not to set incorrect complement value.
Don’t move into the safely fence when robot is moving
automatically.
! CAUTION
Please debug the program carefully before you move robot.
You can use Robot Controller simulation function.
65
6 RT-API
int krnx_GetRtcCompData(
int cont_no,
int robot_no,
float *comp
)
Parameters
cont_no
Controller number
robot_no
Robot number
comp
Address of controller complement data buffer.
Unit: mm for Linear / radian for Rotational
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get RTC Complement data that was set by krnx_SetRtcCompData.
comp[i] is correspond to (i+1)-th axis.
You have to allocate over 72 bytes (18 x sizeof(float)) for the comp buffer.
See also
krnx_SetRtcCompData
66
6 RT-API
int krnx_OldCompClear(
int cont_no,
int robot_no,
)
Parameters
cont_no
Controller number
robot_no
Robot number
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Clear previous RTC complement data.
See also
krnx_SetRtcCompData
67
6 RT-API
int krnx_GetRtcCompLimit(
int cont_no,
int robot_no,
float *comp_limit
)
Parameters
cont_no
Controller number
robot_no
Robot number
comp_limit
Address of RTC Complement data limit buffer.
Unit: mm for Linear / radian for Rotational
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get RTC Complement data limit. When you set RTC Complement data by
krnx_SetRtcCompData, if the difference between previous data and current data is
larger than this limit, an error occurs.
comp_limit[i] is correspond to (i+1)-th axis.
You have to allocate over 72 bytes (18 x sizeof(float)) for the buffer.
See also
krnx_SetRtcCompData
68
6 RT-API
int krnx_SetRtcErrorFlag(
int cont_no,
int robot_no,
int error_flag
unsigned short seq_no
)
Parameters
cont_no
Controller number
robot_no
Robot number
error_flag
RTC Error number.
If the value is negative, AS error message is issued and the robot stops.
seq_no
Sequence number
Please set incremented value one by one every time you call this function.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
AS outputs an error “(E1520) RTC)KRNX set RTC Error.” and the robot stops.
This error flag is reset by AS side error reset.
See also
krnx_GetRtcErrorFlag
69
6 RT-API
int krnx_GetRtcErrorFlag(
int cont_no,
int robot_no,
int *error_flag,
)
Parameters
cont_no
Controller number
robot_no
Robot number
error_flag
Address of RTC Error number buffer
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get RTC Error number that was set by krnx_SetRtcErrorFlag. The error number will
be reset to zero by AS side error reset.
You have to allocate over 4 bytes (sizeof(int)) for the buffer.
See also
krnx_SetRtcErrorFlag
70
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
rtc_sw
Address of RTC Switch buffer
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get RTC Switch information.
Value 1 means RTC switch is ON. Value 0 means RTC switch is OFF.
You have to allocate over 4 bytes (sizeof(int)) area for the buffer.
See also
A.1 RTC_SW (AS Language)
71
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get RTC complement data buffer length of the robot controller.
KRNX sends RTC complement data when krnx_SetRtcCompData() is executed.
After the robot controller receives it, it is stored in the internal buffer.
The robot controller uses the buffer by FIFO while controlling the robot arm.
By comparing this value and the specified buffering_cycle_num by KRNX_RTC, you
can adjust a cycle time lag between KRNX application and the connected robot
controller.
See also
krnx_SetRtcCompData, krnx_PrimeRtcCompData, krnx_SendRtcCompData, A.4
KRNX_RTC (AS Language)
72
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
error_lamp
Address of Error lamp
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get Error lamp asynchronously from the robot controller.
Value -1 means Error lamp is ON. Value 0 means Error lamp is OFF (Normal).
This Error lamp information is updated in each 2 msec.
You can also get the Error lamp information by krnx_GetPanelInfo(), but this API
takes less time than krnx_GetPanelInfo() because of its asynchrony.
(krnx_GetCurErrorLamp: less than 0.5 msec, krnx_GetPanelInfo(): about 20 msec)
See also
krnx_GetPanelInfo
73
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
error_code
Address of Error code.
Refer to AS Language Manual “Error Message” for the robot controller error
code.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Get Error code asynchronously from the robot controller.
This Error code information is updated in each 2 msec.
You can also get the Error code information by krnx_GetErrorInfo(), but this API
takes less time than krnx_GetErrorInfo() because of its asynchrony.
(krnx_GetCurErrorInfo: less than 0.5 msec, krnx_GetErrorInfo(): about 20 msec)
See also
krnx_GetErrorInfo
74
6 RT-API
int krnx_PrimeRtcCompData(
int cont_no,
int robot_no,
const float *comp,
int *status,
)
Parameters
cont_no
Controller number
robot_no
Robot number
comp
Address of the RTC Complement data buffer
Unit : mm for Linear / radian for Rotational
status
Address of complement result status buffer.
The description of value is as below.
Value Description
0x0001 Operational area upper limit over
0x0002 Operational area lower limit over
0x0004 RTC Complement data limit over
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Prime RTC complement data into controller board.
comp[i] is correspond to (i+1)-th axis.
You have to allocate over 72 bytes (18 x sizeof(float)) for the buffer.
The primed data is sent to controller by executing krnx_SendRtcCompData.
If complement data is incorrect, the return value is negative value.
75
6 RT-API
See also
krnx_SendRtcCompData, krnx_SetRtcCompData, krnx_GetRtcCompData,
krnx_GetRtcCompLimit, A.1 RTC_SW, A.4 KRNX_RTC (AS Language)
76
6 RT-API
int krnx_SendRtcCompData(
int cont_no,
unsigned short seq_no
)
Parameters
cont_no
Controller number
seq_no
Sequence number
Please set incremented value one by one every time you call this function.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Send RTC complement data to controller board. If RTC switch is ON, the robot
moves to (AS each axis position command + complement data) position.
Comp[i] is correspond to (i+1)-th axis.
If complement data is incorrect, the return value is negative value.
Since AS command value is updated per 2 msec, RTC Complement data should be
sent per specified cycle time by KRNX_RTC and krnx_GetRtcBufferLength.
You have to allocate over 72 bytes (18 x sizeof(float)) for the buffer.
To use RTC function, RTC-implemented robot controller is required.
Please refer “10 RTC Function” for more detail.
See also
krnx_PrimeRtcCompData, krnx_SetRtcCompData, krnx_GetRtcCompData,
krnx_GetRtcCompLimit, krnx_GetRtcBufferLength, krnx_SetRtcInfo,
krnx_GetRtcInfo, A.1 RTC_SW, A.4 KRNX_RTC, A.5
_
KRNX_RTC_INFO (AS Language)
77
6 RT-API
! WARNING
If incorrect complement value is set, the robot may move to
out of working area or too quickly.
Please be careful not to set incorrect complement value.
Don’t move into the safely fence when robot is moving
automatically.
! CAUTION
Please debug the program carefully before you move robot.
You can use Robot Controller simulation function.
78
6 RT-API
Parameters
cont_no
Controller number
robot_no
Robot number
mask
Mask bit of RTC complement data
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Enable/disable setting RTC complement data.
Enabling/disabling is determined by parameter “mask” for mask bit per joint.
Bit i of “mask” is correspond to (i+1)-th axis and “0/1" means “Disabling/Enabling”.
If setting RTC complement data is disabled, the RTC complement data of disabled
joints does not affect the connected robot controller by krnx_SetRtcCompData or
krnx_PrimeRtcCompData.
To use RTC function, RTC-implemented Robot controller is required.
Please refer “10 RTC Function” for more detail.
See also
krnx_SendRtcCompData, krnx_SetRtcCompData, krnx_GetRtcCompData、
krnx_GetRtcCompLimit、krnx_GetRtcInfo、krnx_SetRtcInfo、RTC_SW、KRNX_RTC、
KRNX_RTC_INFO (AS-Language)
79
6 RT-API
Memo
80
7 Matrix API
7 Matrix API
int krnx_JointToMatrix(
int cont_no,
int robot_no,
const float *joint,
float *matrix
)
Parameters
cont_no
Controller number
robot_no
Robot number
joint
Address of joint value.
Unit: mm for Linear / radian for Rotational
comp[i] is correspond to (i+1)-th axis.
xyzoat
Address of transformation values which describe the position and orientation
of robot flange transformed by parameter “joint”.
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
matrix
Address of transformation matrix which describe the position and orientation
of robot flange transformed by parameter “joint”.
Refer to “9.2 Transformation Matrix” for the format.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Calculate transformation values (XYZOAT) or matrix which describe the position and
orientation of robot flange on robot null base coordinate.
If base/tool transformation values are set, additional calculation of the values are
needed.
krnx_JointToXyzoat calculate transformation values (XYZOAT) from joint values.
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
krnx_JointToMatrix calculate a transformation matrix from joint values.
Please allocate over 48 bytes (sizeof(float) * 3 * 4) area for matrix.
See also
krnx_XyzoatToJoint、krnx_MatrixToJoint
81
7 Matrix API
int krnx_MatrixToJoint(
int cont_no,
int robot_no,
const float *matrix,
float *joint,
const float *old_joint
)
Parameters
cont_no
Controller number
robot_no
Robot number
xyzoat
Address of transformation values which describe the position and orientation
of robot flange.
Refer to “9.1 Transformation Values (XYZOAT)” for the format.
matrix
Address of transformation matrix which describe the position and orientation
of robot flange.
Refer to “9.2 Transformation Matrix” for the format.
joint
Address of joint value transformed by parameter “xyzoat/matrix”.
Unit: mm for Linear / radian for Rotational
comp[i] is correspond to (i+1)-th axis.
old_joint
Address of reference joint values to calculate transformed joint values.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
Calculate joint values which describe the position and orientation of robot flange on
robot null base coordinate.
If base/tool transformation values are set, calculation of the values are previously
needed.
Several joint solutions exist in inverse kinematics. Parameter “old_joint” are used to
find an adequate solution.
If you set NULL to “old_joint”, KRNX calculate a solution based on specified robot
arm configuration. Refer to AS Language Manual “Setting Robot Configurations”.
krnx_XyzoatToJoint calculate joint values from transformation values (XYZOAT).
Please allocate over 72 bytes (sizeof(float) * 18) area for joint.
krnx_MatrixToJoint calculate joint values from transformation matrix. Please allocate
over 72 bytes (sizeof(float) * 18) area for joint.
82
7 Matrix API
See also
krnx_JointToXyzoat、krnx_JointToMatrix
83
7 Matrix API
int krnx_MultiplyMatrix(
const float *matrix_a,
const float *matrix_b,
float *matrix_c
)
Parameters
xyzoat_a
Address of transformation values which multiply from left.
xyzoat_b
Address of transformation values which multiply from right.
xyzoat_c
Address of transformation values which is result of multiplying parameter
“xyzoat_a” and “xyzoat_b”.
matrix_a
Address of transformation matrix which multiply from left.
matrix_b
Address of transformation matrix which multiply from right.
matrix_c
Address of transformation matrix which is result of multiplying parameter
“matrix_a” and “matrix_b”.
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
krnx_MultiplyXyzoat multiplies transformation values.
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
krnx_MultiplyMatrix multiplies transformations matrixes.
Please allocate over 48 bytes (sizeof(float) * 3 * 4) area for matrix.
Please be careful to multiplying order because the results may be different.
See also
84
7 Matrix API
int krnx_InverseMatrix(
const float *matrix_a,
float *matrix_b
)
Parameters
xyzoat_a
Address of transformation values for inverse calculation
xyzoat_b
Address of transformation values which is result of inverse calculation of
parameter “xyzoat_a”
matrix_a
Address of transformation matrix for inverse calculation
matrix_b
Address of transformation matrix which is result of inverse calculation of
parameter “matrix_a”
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
krnx_InverseXyzoat calculates inverse of transformation values.
Please allocate over 24 bytes (sizeof(float) * 6) area for xyzoat.
The result of multiplying original xyzoat and its inverse is XYZOAT=(0,0,0,0,0,0).
krnx_InverseMatrix calculates inverse of transformation matrix.
Please allocate over 48 bytes (sizeof(float) * 3 * 4) area for matrix.
The result of multiplying original xyzoat and its inverse is as below.
1 0 0 0
0 1 0 0
0 0 1 0
See also
85
7 Matrix API
int krnx_XyzoatToMatrix(
const float *xyzoat,
float *to_matrix
)
Parameters
matrix
Address of original transformation matrix
to_xyzoat
Address of transformed transformation values
xyzoat
Address of original transformation values
to_matrix
Address of transformed transformation matrix
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
krnx_MatrixToXyzoat transforms transformation matrix to transformation values.
Please allocate over 24 bytes (sizeof(float) * 6) area for parameter “to_xyzoat”.
krnx_XyzoatToMatrix transforms transformation values to transformation matrix.
Please allocate over 48 bytes (sizeof(float) * 3 * 4) area for parameter “to_matrix”.
See also
86
7 Matrix API
int krnx_FrameMatrix(
const float *mat_a,
const float *mat_b,
const float *mat_c,
const float *mat_d,
const float *mat_p
)
Parameters
xyz_a, xyz_b, xyz_c, xyz_d
Address of original transformation values
xyz_p
Address of transformation values which describe the frame (relative)
coordinates with respect to the base coordinates
Returns
KRNX_NOERROR: OK
Negative value: Error code (refer to “12 Error Code”)
Description
krnx_XyzoatToMatrix calculates the transformation values which describe the frame
(relative) coordinates with respect to the base coordinates.
Please allocate over 24 bytes (sizeof(float) * 6) area for parameter “xyz_p”.
krnx_FrameMatrix calculates the transformation matrix which describes the frame
(relative) coordinates with respect to the base coordinates.
Please allocate over 48 bytes (sizeof(float) * 3 * 4) area for parameter “mat_p”.
See also
87
7 Matrix API
Memo
88
8 Internal API
8 Internal API
8.1 Get KRNX Version
int krnx_GetKrnxVersion(
char *ver_text,
int ver_len,
)
Parameters
ver_text
Specify string buffer for KRNX Version.
ver_len
Specify string buffer length of “ver_text”
If it is shorter than string for KRNX Version, this API gets the string up to
“ver_len”
Returns
KRNX_NOERROR : OK
Negative value : Error code (refer to “12 Error Code”)
Description
Get KRNX Version string. The version differs in its environment and application.
Ex. With executing krnx_GetKrnxVersion( ver_text, 128 ), ver_text got ”KRNX
Linux-x86_64 DEV 2.0.0 2019/03/29 00:00”
89
8 Internal API
Memo
90
9 Dara Structure
9 Dara Structure
9.1 Transformation Values (XYZOAT)
AS software describes the position and orientation of robot arm by 6 values “X,Y,Z,O,A,T”.
“X, Y, Z” describe the position, and “O, A, T” describe the orientation of robot arm. “O, A, T”
means Euler angles whose rotation order is “Z-axis”, “Y-axis”, and “Z-axis”.
The unit of “X, Y, Z” is mm, and the unit of “O, A, T” is radian. AS software treated as
single-precision floats.
This transformation values are passed to API (krnx_GetBaseMatrix, krnx_GetToolMatrix,
etc.) by address pointer. Pointed data structure is as below.
Offset Data
0 Position・X-coordinate(mm)
4 Position・Y-coordinate(mm)
8 Position・Z-coordinate(mm)
12 Orientation・O(radian)
16 Orientation・A(radian)
20 Orientation・T(radian)
nx ox ax px
ny oy ay py
nz oz az pz
Column vector n、o、a are unit vectors orthogonal to each other to describes the orientation
of robot arm. Column vector p describes the position of robot arm and its unit is mm.
This transformation matrix is passed to API (krnx_MatrixToJoint, krnx_MultiplyMatrix, etc.)
by address pointer. Pointed data structure is as below.
91
9 Dara Structure
9.3 TKrnxIoInfo
typedef struct
{
char io_do[KRNX_MAXSIGNAL/8];
char io_di[KRNX_MAXSIGNAL/8];
char internal[KRNX_MAXSIGNAL/8];
} TKrnxIoInfo;
Members
io_do
External Output Signals
io_do[0] Bit0 corresponds to signal number 1.
io_do[1] Bit7 corresponds to signal number 16.
io_di
External Input Signals
io_di[0] Bit0 corresponds to signal number 1001
io_di[1] Bit7 corresponds to signal number 1016.
internal
Internal Signals
internal[0] Bit0 corresponds to signal number 2001.
internal[1] Bit7 corresponds to signal number 2016.
See also
krnx_GetCurIoInfo
92
9 Dara Structure
9.4 TKrnxIoInfoEx
typedef struct
{
char io_do[DO_MAX_SIGNAL/8];
char io_di[DI_MAX_SIGNAL/8];
char internal[INTERNAL_MAX_SIGNAL/8];
} TKrnxIoInfoEx;
TKrnxIoInfoEx includes robot IO information (Extended). This extended one includes more
size of signals (DO_MAX_SIGNAL, DI_MAX_SIGNAL, INTERNAL_MAX_SIGNAL)
Members
io_do
External Output Signals
io_do[0] Bit0 corresponds to signal number 1.
io_do[1] Bit7 corresponds to signal number 16.
io_di
External Input Signals
io_di[0] Bit0 corresponds to signal number 1001
io_di[1] Bit7 corresponds to signal number 1016.
internal
Internal Signals
internal[0] Bit0 corresponds to signal number 2001.
internal[1] Bit7 corresponds to signal number 2016.
See also
krnx_GetCurIoInfoEx
93
9 Dara Structure
94
9 Dara Structure
9.5 TKrnxPanelInfo
typedef struct
{
short error_lamp;
short motor_lamp;
short cyc_lamp;
short repeat_lamp;
short run_lamp;
short trigger_lamp;
short teach_lock_lamp;
short emergency;
} TKrnxPanelInfo;
Members
error_lamp
Status of error lamp
0: Normal -1: Error
motor_lamp
Status of motor power lamp
0: Motor power off, -1: Motor power on
cyc_lamp
Status of cycle start lamp
0: Cycle start lamp off, -1: Cycle start lamp on
repeat_lamp
Status of repeat mode
0: Teach mode, 1: Repeat mode
run_lamp
Status of run
0: Hold, 1: Run
triggert_lamp
Status of trigger switch
0: Trigger switch off, -1: Trigger switch on
teach_lock_lamp
Status of teach lock
0: Teach lock off, 1: Teach lock on
emergency
Status of emergency button
0: Emergency stop off, 1: Emergency stop on
See also
krnx_GetPanelInfo
95
9 Dara Structure
9.6 TKrnxProgramInfo
typedef struct
{
TKrnxMonInfo mon[KRNX_MAX_ROBOT];
TKrnxStepperInfo robot[KRNX_MAX_ROBOT];
TKrnxStepperInfo pc[3];
} TKrnxProgramInfo;
typedef struct
{
short robot_status;
float monitor_speed;
float always_speed;
float accuracy;
} TKrnxMonInfo;
Members
robot_status
Robot status. (refer to the below table)
Multiple value can be set by “OR” operation.
Value Description
0x0001 Error
0x0002 Motor Power On
0x0004 Repeat Mode
0x0008 Working as Repeat Mode
0x0010 Check Mode
monitor_speed
Monitor speed (%)
always_speed
Program speed that was specified with ALWAYS (%)
96
9 Dara Structure
Members
status
Value Description
0x0001 WAIT
0x0002 EXECUTING
0x0004 STOP
exec_count
The number of program execution
remain_count
The number of remained program execution.
-1 means unlimited.
program_name
Executing program name.
priority
Priority of the program
step_number
Step number of executing program
step_name
Executing program instruction
See also
krnx_GetProgramInfo
97
9 Dara Structure
9.7 TKrnxCurMotionData
typedef struct
{
float ang[KRNX_MAXAXES]; /* Joint angle present value [rad or mm] */
float ang_ref[KRNX_MAXAXES]; /* Joint angle command value [rad or mm] */
float cur[KRNX_MAXAXES]; /* Joint current present value [A] */
int enc[KRNX_MAXAXES]; /* Joint encoder present value [bit] */
} TKrnxCurMotionData;
See also
krnx_GetCurMotionData, krnx_SetRtCyclicDataKind, krnx_GetRtCyclicDataKind
98
9 Dara Structure
9.8 TKrnxCurMotionDataEx
typedef struct
{
float ang[KRNX_MAXAXES]; /* Joint angle present value [rad or mm] */
float ang_ref[KRNX_MAXAXES]; /* Joint angle command value [rad or mm] */
float cur[KRNX_MAXAXES]; /* Joint current present value [A] */
int enc[KRNX_MAXAXES]; /* Joint encoder present value [bit] */
float cur_ref[KRNX_MAXAXES]; /* Joint current command value [A] */
float cur_sat[KRNX_MAXAXES]; /* Joint current saturation present ratio */
float cur_sat_ref[KRNX_MAXAXES]; /* Joint current saturation command ratio */
int enc_ref[KRNX_MAXAXES]; /* Joint encoder command value [bit] */
float ang_vel[KRNX_MAXAXES]; /* Joint velocity present value [rad/s or mm/s] */
float ang_vel_ref[KRNX_MAXAXES]; /* Joint velocity command value [rad/s or
mm/s] */
float xyzoat[6]; /* Transformation position present value [rad or mm] */
float xyzoat_ref[6]; /* Transformation position command value [rad or mm] */
float xyzoat_vel; /* Transformation velocity present value [rad/s or mm/s] */
float xyzoat_vel_ref; /* Transformation velocity command value [rad/s or mm/s] */ }
TKrnxCurMotionDataEx;
TKrnxCurMotionDataEx includes motion data (Extended) for robot arm. This extended one
includes some additional data such as joint saturation ratio.
See also
krnx_GetCurMotionDataEx, krnx_SetRtCyclicDataKind, krnx_GetRtCyclicDataKind
99
9 Dara Structure
9.9 TKrnxRtcInfo
typedef struct
{
short cyc;
short buf;
short interpolation;
} TKrnxRtcInfo;
Members
cyc
RTC cycle time [ms].
The range is 2 ~ 1000ms in 2ms.
buf
RTC buffering cycle number.
AS starts RTC control after receiving this size of RTC complement data.
By increasing this number, RTC control of KRNX application can be stable,
but delay of RTC command to the robot arm also increases.
The range is 1 ~ 1000.
interpolation
RTC interpolation method between “RTC cycle time” and “AS cycle time
(2ms)”.
For example, if RTC cycle time is 8 [ms], this interpolation method decides
values of RTC complement data [2ms, 4ms, 6ms].
See also
krnx_SetRtcInfo, krnx_GetRtcInfo
100
10 RTC Function
10 RTC Function
10.1 About
RTC (Real Time Correction) function can add RTC value to joint angles per 2 msec. User
program have to calculate RTC value par specified cycle. User program can use RTC Function
by using RT-API. RT-API can also get robot’s current joint angles par 2 msec.
Basically, PC user program fixes joint command values in AS robot program and control the
joints by RTC complement data. Overall system architecture including AS system and RT-API
is as below.
Limit Info
Robot Arm
・Limit of joint displacement range
・Limit of joint velocity range
2 msec cycle
Get Robot Program State Buffer Control RTC Complement Control RTC Info Setting
krnx_GetCurErrorInfo
krnx_OldCompClear krnx_PrimeRtcCompData krnx_GetRtcCompData
krnx_SetRtcCompMask
program
User
Motion Planning
Fig. 10.1 Overall system architecture: Bold line describes cyclic process and normal
line describes acyclic process .
10.2 Procedure
Procedure to utilize RTC function is as below. More detail is described in next sections.
101
10 RTC Function
.PROGRAM rb_rtc1()
RTC_SW 1: ON
1 RTC_CTL
GOTO 1
RTC_SW 1: OFF
.END
.PROGRAM rb_rtc2()
RTC_SW 2: ON
1 RTC_CTL
GOTO 1
RTC_SW 2: OFF
.END
10.2.2. Preparation of Robot Program for RTC Function (If RTC_CTL is not
supported)
In 10.2.1, if using AS which is not supporting RTC_CTL, please refer to this section.
RTC function needs to prepare a dedicated robot program. Please create a robot program
as below. This robot program uses “#rtchome1”, “#rtchome2” for joint displacement values. So
please do not use them in other robot/PC programs.
.PROGRAM rb_rtc1()
HERE #rtchome1
ACCURACY 0 ALWAYS
RTC_SW 1: ON
1 JMOVE #rtchome1
GOTO 1
RTC_SW 1: OFF
.END
.PROGRAM rb_rtc2()
HERE #rtchome2
L3ACCURACY .acc[1] ALWAYS
FOR .i = 1 TO 8
.acc[.i] = 0
END
L3ACCURACY .acc[1] ALWAYS
RTC_SW 2: ON
1 JMOVE #rtchome2
GOTO 1
RTC_SW 2: OFF
.END
103
10 RTC Function
Fig. 10.2 The display of teach pendant when RTC switch is turned ON and the robot
program continues the step “1 JMOVE #rtchome1”
! DANGER
If you want to continue the robot program which was stopped due to
HOLD/ABORT/ERROR and etc., be sure to continue from step number 1
(HERE #rtchome1 or 2). Be sure not to continue from a step which the
robot program was stopped (ex. CONTINUE in AS Language). It you do,
the robot arm firstly moves to the position which previous robot program
set. This is dangerous.
104
10 RTC Function
105
10 RTC Function
Merged
Joint command values
Joint command Servo Control Robot Arm
(Fixed)
values
2 msec cycle
[C] msec cycle
Buffer 2
Buffer n
2 msec cycle
krnx_SetRtcCompData
KRNX API
krnx_GetRtcBufferLength krnx_SendRtcCompData
krnx_PrimeRtcCompData
When AS received RTC complement data from user program, AS stores the received buffer
with that data. This received buffer are processed in FIFO manner. When the data length of
this received buffer exceeds the specified buffering cycle number (refer to 10.2.3), AS pops the
data in the specified cycle time and adds it to joint angles of the robot arm. This popping cycle
time is specified by 10.2.3, so this may be different from AS cycle time (2 msec). If so, AS
interpolates the RTC complement data by specified method (refer to 10.2.3) and adds the
interpolated value to joint angles of the robot arm par AS cycle time (2 msec).
After AS pops the RTC complement data, user program pushes and AS pops RTC
complement data in the specified cycle time. Because this cycle time of user program and AS
is almost same, the data length of AS received buffer keeps the nearly buffering cycle number
(refer to 10.2.3). User program can adjust its cycle time by using this data length as feedback
of cycle time difference between user program and AS.
Here are two examples of adjusting cycle time of user program. It assumes that the data
length of AS received buffer decreases from the specified buffering cycle number over time.
This means that the cycle time of user program is slightly slower than the cycle time of AS. In
this case, user program can adjust its cycle time by hastening and the data length of AS
received buffer can be back to the specified buffering cycle number. The opposite is the same.
It assumes that the data length of AS received buffer increases from the specified buffering
cycle number over time. This means that the cycle time of user program is slightly faster than
the cycle time of AS. In this case, user program can adjust its cycle time by latening and the
data length of AS received buffer can be back to the specified buffering cycle number.
106
10 RTC Function
complement data user program sends may be lost in network between the user program and
the robot controller.
107
10 RTC Function
2: krnx_SetRtcInfo()
2.1: send RTC information data()
3: krnx_GetRtcCompLimit()
4: krnx_OldCompClear()
5: krnx_Execute()
5.1: execute the RTC robot program()
7: JMOVE()
8: krnx_PrimeRtcCompData()
9: krnx_SendRtcCompData()
9.1: send RTC complement data()
opt : Feedback
12: send robot arm data()
13: krnx_GetCurMotionData()
14: krnx_GetRtcSwitch()
15: krnx_GetCurErrorLamp()
16: krnx_GetCurErrorInfo()
opt : Synchronization
17: krnx_GetRtcBufferLength()
19: krnx_Hold()
19.1: hold the RTC robot program()
20: krnx_Close()
20.1: disconnect to the robot controller()
108
10 RTC Function
In RTC function, AS doesn’t plan the motion of the robot arm and user program plan the
motion by sending RTC complement data. Thus the robot controller doesn’t warrant the motion
planning of the robot arm and its motion in RTC function.
10.29.2. Restriction about position, velocity, acceleration of joint angles in RTC function
In RTC function, AS has received buffer of RTC complement data from user program (refer
to 10.2.7). Sure to adjust the data length of AS received buffer to the buffering cycle number. If
the data length of AS received buffer became 0, AS couldn’t pop a new RTC complement
value and the velocity of the robot arm would change to 0. If this change happened when the
velocity of the robot arm is high, the deceleration of the robot arm would be high and the robot
arm would momentarily stop its motion. The other hand, if the data length of AS received buffer
were over 1000 and user program continued to send the RTC complement data, AS couldn’t
store the received buffer with the data and it might be lost.
In RTC function, AS controls the robot arm by dedicated robot program. Therefore AS
cannot execute superposition of usual motion of robot program and RTC motion of this
dedicated robot program.
In RTC function, user program have to control the robot arm in realtime. Be sure to make
stable network environment such as environment which user program and the robot controller
are connected via same LAN. Do not sure to make unstable network environment such as
environment which user program and the robot controller are connected via WAN.
109
10 RTC Function
In RTC function, KRNX uses the network function of the robot controller. Please do not use
other network functions which use the Ethernet port of the robot controller (e.g. EtherNet/IP)
110
10 RTC Function
Memo
111
11 Thread-safety and Reentrancy of API
112
12 Error Code
12 Error Code
Error Codes returned by APIs are defined in <krnx.h> .
The below table show the error code value and description.
KRNX_NOERROR No error -
(0)
KRNX_E_NOTSUPPO The connected robot This API doesn’t support the robot arm of
supports.
(-0x1004) while.
KRNX_E_FOPENFAIL Failed to open the file KRNX failed to open the specified file.
ADY
(-0x1006)
KRNX_E_MATRIX Matrix calculation error The specified matrix cannot be calculated by this
(-0x1007) API.
KRNX_E_OUTOFRAN Out of range error in The result of inverse kinematics is out of range.
113
12 Error Code
(-0x1009) matrix
KRNX_E_COMPDATA RTC complement data The specified RTC complement data is invalid.
argument “status”.
(-0x100c)
KRNX_E_NULLRESP NULL response from KRNX received NULL data from AS.
you use.
(-0x100e) timeout) Please execute the API again checking that your
KRNX_E_BUFSND Sending buffer error KRNX sent the sending request by general
from AS.
Please check that network environment is normal
you use.
KRNX_E_BUFRCV Receiving buffer error KRNX sent the receiving request by general
from AS.
you use.
again.
114
12 Error Code
(-0x1020) AUX-API.
address.
KRNX_E_IOCTLSOCK Failed to execute ioctl KRNX failed to execute ioctl about internal
socket process.
KRNX_E_SOCKWRIT Writing socket error KRNX failed to write the internal socket.
process.
KRNX_E_SOCKREAD Reading socket error KRNX failed to read the internal socket.
is normal.
RT port_ref.tbl is invalid.
available.
again.
115
12 Error Code
robot controller.
KRNX_E_UNEXPECT Received data format Received data format KRNX received from AS in
KRNX_E_KINENOTRE Matrix-API doesn’t This Matrix-API doesn’t support the robot arm of
(-0x2011) robot arm Please use AS and its robot arm which KRNX
supports.
simultaneously.
AS to make data.
KRNX_E_BUFDATAN The number of sending The number of sending data specified by the API
AL
(-0x2100)
116
12 Error Code
normal.
(-0x2202)
(-0xFFFF)
Moreover, there are another error codes that are returned by robot controller.
Refer to “AS Language Manual” for the error codes.
117
13 Related File
13 Related File
port_def.tbl
port_ref.tbl aux=23:udp=[8101,8102]:telnet=23:kosmos=8000:pl
#0 :1 c=9000;0
#1 :2
#2 :3 aux=23:udp=[9101,9102]:eth=[9103,9104]:telnet=9
#3 :4 105:kosmos=9106:plc=9107:sync=9108;1
#4 :5 aux=9200:udp=[9201,9202]:eth=[9203,9204]:telnet
#5 :6 =9205:kosmos=9206:plc=9207:sync=9208;2
#6 :7
#7 :8
aux=9800:udp=[9801,9802]:eth=[9803,9804]:telnet
=9805:kosmos=9806:plc=9807:sync=9808:8
You need to change this setting based on the target (E-Controller or PC-AS)
AUX UDP ETH TELNET KOSMOS PLC
E-Controller 23 9101,9102 9103,9104 23 9106 9107
PC-AS 9100 9101,9102 9103,9104 23 9106 9107
118
13 Related File
Memo
119
14 Example
14 Example
PC
krnx_Open()
krnx_GetCurMotionData()
krnx_GetCurIoInfo()
krnx_Close()
120
Appendix. A:AS Language
A.1 RTC_SW
Format
RTC_SW <robot_no>: <ON/OFF>
Description
Set RTC switch.
When RTC switch is ON, axis position command equals “AS position command +
complement data”.
It can be used as a program instruction.
As a monitor command, it can be used to only turn RTC switch OFF in teach mode.
Parameters
robot_no:
Robot number
If not specified, 1 is assumed.
ON/OFF:
“ON” or “OFF” of RTC switch
If not specified, “OFF” is assumed.
121
Appendix. A:AS Language
A.2 RTC_STATUS
Format
RTC_STATUS <robot_no>:
Description
Show RTC status.
It shows status of RTC switch and RTC error.
Parameters
robot_no:
Robot number
If not specified, 1 is assumed.
A.3 RTC_CTL
Format
RTC_CTL
Description
When RTC switch is ON, this instruction set the axis position command to “AS
position command + RTC complement data”.
It can be used as a program instruction.
Parameters
None
A.4 KRNX_RTC
Format
KRNX_RTC[qualifier] <cycle_time> <buffering_cycle_num> <interpolation_method>
Description
Change KRNX’s RTC setting.
This is same as API “krnx_SetRtcInfo”, “krnx_GetRtcInfo”
122
Appendix. A:AS Language
Parameters
qualifier:
If “/N” is specified, queries of parameters are omitted.
cycle_time:
Set RTC cycle time [ms].
The range is 2 ~ 1000ms in 2ms.
Default value is 4 [ms].
buffering_cycle_num:
Set RTC buffering cycle number.
AS starts RTC control after receiving this size of RTC complement data.
By increasing this number, RTC control of KRNX application can be stable, but
delay of RTC command to the robot arm also increases.
The range is 1 ~ 1000.
Default value is 1.
Interpolation_method:
Set RTC interpolation method between “RTC cycle time” and “AS cycle time
(2ms)”.
For example, if RTC cycle time is 8 [ms], this interpolation method decides
values of RTC complement data [2ms, 4ms, 6ms].
A.5 KRNX_RTC_INFO
Format
KRNX_RTC_INFO
Description
Show information of KRNX’s RTC
Parameters
123
Appendix. A:AS Language
None.
Output format
BUFFER:
Show current buffering number of RTC complement data.
If a difference between this value and specified “buffering_cycle_num” of
KRNX_RTC, there would be a difference of cycle time between actual execution
of RTC API and specified “cycle_time” of KRNX_RTC. To solve this, please
adjust the cycle time of RTC API by using krnx_GetRtcBufferLength.
BUFFER_0:
Show the number of times of when buffering number of RTC complement data is
“0”. This counting starts when RTC switch turns ON and RTC buffering number
reaches specified “buffering_cycle_num” of KRNX_RTC.
If this number is not equal to “0”, cycle time of RTC API would be slower than
specified “cycle_time” of KRNX_RTC.
This number is reset to “0” when RTC switch turns OFF.
SEQ_ERR:
Show the number of times of when a difference of consecutive sequence
number is not equal to “1”. This counting starts when RTC switch turns ON.
If this number is not equal to “0”, the reason would be either wrong input of
sequence number of RTC API, or packet loss of sending RTC complement data.
This number is reset to “0” when RTC switch turns OFF.
124
Appendix. B:API List
Common API
Name Description Page
krnx_Close Disconnect from Robot Controller 20
AUX-API
Name Description Page
krnx_Abort Abort Robot Program 21
125
Appendix. B:API List
AS-API
Name Description Page
krnx_AsApiTimeoutPeriod Set AS-API Timeout Period 56
RT-API
Name Description Page
krnx_GetCurMotionData Get Current Motion Data 61
126
Appendix. B:API List
Matrix-API
Name Description Page
krnx_FrameMatrix Calculate Frame Coordinates 87
Internal-API
Name Description Page
krnx_GetKrnxVersion Get KRNX Version 89
127