RemoteAPI example program for Leantec Robot(ENG)
RemoteAPI example program for Leantec Robot(ENG)
匯出日期:2024-11-29
修改日期:2021-07-29
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
內容
目錄
1. Introduction of RemoteAPI
2. Connection Setting
2.1 Connection Settings of Controller
2.2 Download RemoteAPI sample program
2.3 PC Connection Setting
2.4 Check Connection Status
3. Basic Operation
3.1 One-to-many connection
3.2 HMI Component Description
3.2.1 Status monitoring component
3.2.2 File operation compoenent
3.2.3 Machine running setting component
3.3 Robot programming operation
3.3.1 Programming with controller
3.3.2 Progamming with PC
4. Advanced Operation
5. Appendix
5.1 PLC Component Description
5.2 MACRO Variable
5.3 Robot Programming Syntax
6. Reference
–2
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
1 1. Introduction of RemoteAPI
Syntec controller architecture used a set of Application Programming Interface (API) to connect the Human-
Machine Interface (HMI) and the kernel, which allows user to use a simple, easy-to-understand and easy-to-
operate interface (such as handheld pendant, controller panel) to operate the machine. However, RemoteAPI
is developed due to the demand for remote operation and remote monitoring increases, and to meet the
needs of cross-platform program development. Syntec dipole function separates the HMI from the kernel,
which allows user to control the back-end controller through the Internet through the application of the front
desk (such as a standard HMI). User can utilize this architecture to perform remote monitoring and diagnosis,
and the development environment of front desk applications is no longer limited to Windows CE platform. The
applications can be developed in different platform such as Windows XP and Windows 7, which can be
developed to create unlimited possibility.
Applicable Software Version: 10.118.12A and above
Warning
RemoteAPI sample code of the robot provides 'cycle start' function, but it is strongly not recommended
user to use unless necessary. If user wants to use cycle start function remotely, please ensure that the
robot is within user's sight, emergency stop button is located where the user can access easily, lower down
the override feedrate, and no error in the programs before cycle start.
1. Introduction of RemoteAPI – 3
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Origin
al PLC
Modifi
ed PLC
1. Introduction of RemoteAPI – 4
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
2 2. Connection Setting
RemoteAPI used Ethernet to connect controller and PC. hence it is required to do setting on controller and PC
respectively. This chapter explains the steps of connection settings, check connection status and
troubleshooting. In addition, RemoteAPI also can connect to simulator but the HMI of the simulator and
RemoteAPI are different system, therefore the simulator will not show updated coordinate information when
execute moving command by RemoteAPI, and vice versa.
2. Go to F5 System → F2 Maintain → F2 Network Setting → F5 Kernel Server, will show two parameters:
a. Start server at boot: Automatically activate the kernel Dipole function when booting, select "On".
b. Timeout (milliseconds): When there is no response from the network for more than the timeout
setting, the network connection will be interrupted. It is recommended to set to 0 (the network
connection is not interrupted).
Press F1 to start the server and F3 to confirm after setting completed.
3. Then make the following three sets of settings on the "IP Address Parameter" page:
a. IP Address Setting set as "Specify an IP Address.
b. Fill up the IP address, normally used 192.168.0.x
c. Subnet Mask used 255.255.255.0。
2. Connection Setting – 5
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Press F1 to save the settings after completed, then the connection settings of controller is done.
Since the "Start server at boot" function has been turned on in step 3, hence no need to do
settings again after the next boot.
After the setting is completed, check the PLC S bit (S98). If S98 is on, it means that the kernel
server is turned on.
2. Connection Setting – 6
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
2. Copy the files in the simulator and replace the files in the sample program. (The picture below shows
the files that need to be copied according to the program environment 32-bit or 64-bit)
Note
Develop a 64-bit program required use the 64-bit front-end SDK environment. Please ask the
R&D unit for the latest x64 dll.
空行空行
3. This step is split into two operation scenarios:
a. Connect between RemoteAPI and the controller:
Open the Control Panel> Network and Internet> Network and Sharing Center> Change the
interface card settings, right-click the area connection location, and select "Properties".
Select "Internet Protocol Version 4 (TCP/IPv4)" and click "Properties".
Select "Use the following IP address" and set the IP address to the same domain as the controller,
that is, the first 3 addresses of this IP address are the same as the controller IP address.
The subnet mask is set to 255.255.255.0.
2. Connection Setting – 7
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
The IP address of the computer and the controller can not be exactly the same,
otherwise there will be the connection error.
2. Connection Setting – 8
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
空白
2. Enter the IP of the controller in the "Connect to IP" field and click "Connect". This IP will appear in the
"Select Connected IP" list.
To connect between RemoteAPI and the simulator, the input IP is 127.0.0.1.
2. Connection Setting – 9
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
3. Select the IP address just entered, and then click "Information". The three fields on the right will show
the current controller information.
Check the PLC S-bit on the controller when connecting. If S99 is on, it means the controller is
connected.
2. Connection Setting – 10
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
3 3. Basic Operation
This chapter explains the functions and usage of the RemoteAPI robot sample program, including connection
establishment, status and coordinate monitoring, alarm prompts, robot program file operation and execution
processing, etc.
If need to use functions other than the sample program, refer to Chapter 4 Advanced Operation or the
RemoteAPI Operation Manual and modify the code.
2. Method 2:
Setting by modifying the code. First open the .sln file in the example program, right-click
3. Basic Operation – 11
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
ExampleForm.cs in the Solution Explorer column on the left, and select "View Code".
Find the controller IP setting at the 31st line of the code, and set one or more groups of IP by user. After
entering the Debug mode, these IPs will appear in the "Select Connected IP" list.
3. Basic Operation – 12
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
1. Joint Coordinate List: Display the name of all axis and its joint coordinate, update every 300ms.
2. Tool Center Point (TCP) List: Display current coordinate in the current coordinate system,
update every 300ms.
3. Current Information List: Display current selected information, if controller have alarm then it
will display in this field and overwrite the current display information.
4. Information Button: Display information of the controller, includes controllable axes, machine
type, maximum axes, controller series, and controller version.
5. Status Button: Display current controller status, includes main program, current program,
current program line, machine mode, and machine status.
6. NC File List Button: Display all NC files in the controller.
7. PLC bits Column: Display PLC I/O/C/S/A bit or Register value.
For example, if want to display the value of S33 to confirm whether the boot is completed and the
system is normal, enter "S33" in this field and click the "Read" button, and the information will be
displayed in the Current Information list.
Similarly, if want to display the Register number 13 to confirm the current mode, enter "R13" and
click the "Read" button.
3. Basic Operation – 13
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
3. Basic Operation – 14
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
1. Auto Mode Button: Switch machine mode as "Auto Mode", same function as "Auto" button on
pendant.
2. Reset Button: Reset the controller, same function as "Reset" button on pendant, can reset some
alarms.
3. Rate- Button: Decrease 10% of override feedrate, same function as "OVRD -" button on pendant.
4. Rate+ Button: Increase 10% of override feedrate, same function as "OVRD +" button on pendant.
5. Start Button: Cycle start the main program, same function as "Start" button on pendant.
If the robot is not in "Auto" mode or alarm has not been cleared, there will be no
function when press the start button.
6. Hold Button: Pause the running program, same function as "HOLD" button on the pendant.
Do not directly set the MACRO code written on the computer as the main program of the controller,
otherwise an error will occur. Please refer to the steps in this chapter.
3. Basic Operation – 15
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
3.3.1
3.3.1 Programming with controller
1. User can access program edit page in 'F1 Program Edit' in the controller. For detailed
programming methods, please refer to the articulated robot operating manual.
The following figure shows a completed program, which the file name is 'RobotProgram'.
2. Open the RemoteAPI sample program and enter the Debug mode, enter the controller IP in the
"Connect to IP" field to connect to the robot controller, and select the IP to be operated in the
"Select Connected IP" list.
3. Click the "Status" button to confirm whether the main program is the program edited above,
please proceed with the following three steps if it is not the program:
a. Click the "NC File List" button to display all programs in the controller.
b. Select the program edited above, this example is RobotProgram.
c. Click "Set Main NC File" to set it as the main program.
3. Basic Operation – 16
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
4. Click the "Status" button to confirm whether the Mode is AUTO, click the "Auto Mode" button to
change the mode to auto mode if the robot is not in auto mode.
For safety purpose, please lower down the override feedrate when executing it for the first time.
安全起見,第一次執行前請先降低倍率。
Note
RemoteAPI sample code of the robot provides 'cycle start' function, but it is strongly not
recommended user to use unless necessary.
If user wants to use cycle start function remotely, please ensure that the robot is within
user's sight, emergency stop button is located where the user can access easily, lower
down the override feedrate, and no error in the programs before cycle start.
3. Basic Operation – 17
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
2. Write the MACRO code with PC and name the file as "SubProgram" without the extension.
The program must end with "M99;", which represents the end of the subprogram.
3. Open the RemoteAPI sample program and enter the Debug mode, enter the controller IP in the
"Connect to IP" field to connect to controller, and select the IP to be operated in the "Select
Connected IP" list.
4. Click the "Upload NC File" button to upload the SubProgram file in the computer to the
controller.
5. Follow the step 3~5 in section 3.3.1 to start running the program.
Please do not to set SubProgram as the main program, otherwise an error will occur.
RobotProgram is set as the main program in this example.
Note
RemoteAPI sample code of the robot provides 'cycle start' function, but it is strongly not
recommended user to use unless necessary.
If user wants to use cycle start function remotely, please ensure that the robot is within
user's sight, emergency stop button is located where the user can access easily, lower
down the override feedrate, and no error in the programs before cycle start.
3. Basic Operation – 18
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
4 4. Advanced Operation
The RemoteAPI library provides 10 groups of more than 70 APIs. If user required to use functions other than
the sample program, user can add or modify the code by theirself.
This chapter explains the common functions provided by the RemoteAPI library which did not include in
sample program. For complete functions and detailed explaination, please refer to the RemoteAPI operation
manual or the Syntec standard one-to-many API specification.
READ_time: Time
Argument
Variable Type [in/out] Description
Argument
Variable Type [in/out] Description
4. Advanced Operation – 19
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Argument
Variable Type [in/out] Description
Argument
Variable Tyoe [in/out] Desription
Argument
Variable Type [in/out] Description
Note 1. 'count' is the number of records to be read, and returns the number
of records read.
2. When 'count' is 0, it returns all operation logs
3. When timeout error occurs, use the SynetcRemoteCNC( ip, timeout)
constructor to increase the timeout time. Timeout = 0 means none,
and the unit of timeout is ms.
4. The OPLog returned can refer to the appendix for relevant
information.
5. If there is no Log, the original array is still returned and "No Log" is
written.
4. Advanced Operation – 20
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Argument
Variable Type [in/out] Description
Argument
Variable Type [in/out] Description
4. Advanced Operation – 21
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Argument
Variable Type [in/out] Description
Argument
Variable Type [in/out] Description
Argument
Variable Type [in/out] Description
4. Advanced Operation – 22
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Argument
Variable Type [in/out] Description
Argument
Variable Type [in/out] Description
The return value of 0 means the command is completed. For other information, please refer to the
operation manual for the return error description.
4. Advanced Operation – 23
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
5 5. Appendix
O Actual Output
TM Auxiliary Timer Can select unit of 1s, 0.1s, 0.01s, 0.001s TM0~TM255
5. Appendix – 24
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Name Description
MPG Mode:
1: x1 LIU
2: x10 LIU
3: x100 LIU
4: The magnified rate is set in Pr2001
5. Appendix – 25
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
R103~R255 Yes
R256~R511 No
R2091~R2099
R3101~R4095
R11000~R14999
5. Appendix – 26
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
@0 VACANT Read -
Note • Unless being power-off, all global variables have no life cycle limit.
• If @1~@400 needs to be remained after power-off, please goes with
No3811.
Local Variable
#0 VACANT Read -
5. Appendix – 27
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Note • The life cycle of local variables applied in MACRO is limited to the MACRO
execution. After execution is done, local variable returns to VACANT
automatically.
• Subprogram can share local variables with main program, the life cycle of local
variable also ends when main program is completed.
Movement Syntax
Application Syntax
Swaitsig SWAITSIG
Syncout SYNCOUT
5. Appendix – 28
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Application Syntax
Additional Command
Smooth PL / PQ / PR
Sample Program
Using MOVL and MOVJ Command of 6-Axis Articulate Robot Arm as example, this sample program is a
sub-program, hence end the program with M99.
5. Appendix – 29
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
5. Appendix – 30
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
6 6. Reference
1. RemoteAPI 操作手冊
2. 新代科技標準一對多API規格書
3. 新版關節型機器人操作手冊
4. PLC介面說明
5. PLC發展工具操作手冊
6. MACRO變數規格
7. MACRO發展工具操作手冊
8. 機器人語法指令規格
6. Reference – 31
联达产品/LEANTEC Products
–
RemoteAPI example program for Leantec Robot.
Data Type
Type memory
byte 8 bits
short 16 bits
int 32 bits
float 32 bits
string XX
-17 Protocol error (Ethernet Data from Ethernet Board is incorrect.Contact with the service
version only) section or the section in charge.
-16 Socket error (Ethernet Investigate CNC power supply, Ethernet cable and I/F board.
version only)
-15 DLL file error There is no DLL file for each CNC series corresponding to specified
node.
-7 Version mismatch between The CNC/PMC version does not match that of the library.Replace
the CNC/PMC and library the library or the CNC/PMC control software.
-2 Reset or stop request The RESET or STOP button was pressed.Call the termination
function.
1 Error(function is not Specific function which must be executed beforehand has not
executed, or not available) been executed.Otherwise that function is not available.
2 Error(data block length Check and correct the data block length or number of data.
error, error of number of
data)
12 Error(CNC mode error) The CNC mode is incorrect.Correct the CNC mode.
18 Error(Not found Machine ID) Please Check or not send CNC_CONNECTION command.
20 Error(Need to Update RemoteAPI version is too old for connected controller, need to
RemoteCnc Version) update RemoteAPI version.
7.2 Basic
isUSBExist
Function Name bool isUSBExist( )
Argument
Variable name Type [in/out] Introduce
None
SeriesNo:Controller Series No
Function Name string SeriesNo(…)
Argument
Variable Type [in/out] Introduce
name
None
Argument
Variable Type [in/out] Introduce
name
None
Argument
Variable name Type [in/out] Introduce
None
READ_information:Information
Function Name short READ_information(…)
Argument
Variable name Type [in/out]
READ_status:status
Function Name short READ_status(…)
Argument
Variable name Type [in/out] Introduce
READ_position:Position
Function short READ_position(…)
Name
Argument
Variable Type [in/out] Introduce
name
READ_gcode:G Code
Function Name short READ_gcode(…)
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
READ_spindle:spindle speed
Function Name short READ_spindle(…)
Argument
Variable name Type [in/out] Introduce
READ_time:time
Function Name short READ_time(…)
Argument
Variable name Type [in/out]
DOWNLOAD_work_record:
Function Name short DOWNLOAD_work_record (…)
Argument
Variable name Type [in/out] Introduce
READ_MakerConfigInfo
Function Name short READ_MakerConfigInfo(…)
Argument
Variable name Type [in/out]
WRITE_MakerConfigInfo
Function Name short WRITE_MakerConfigInfo(…)
Argument
Variable name Type [in/out]
szModel string in
szMachSN string in
szDate string in
szDevSN string in
szPhone string in
READ_alm_current:Current alarm
Function Name short READ_alm_current(…)
Argument
Variable name Type [in/out]
READ_alm_history:alarm history
Function Name short READ_alm_history(…)
Argument
Variable name Type [in/out]
Argument
Variable name Type [in/out]
Argument1
Variable name Type [in/out]
szProgName string in
Argument2
Variable name Type [in/out] Introduce
szProgName int in X
Argument
Variable Type [in/out] Introduce
name
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out]
Name string in
Argument
Variable name Type [in/out]
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
Argument
Variable Type [in/out] Introduce
name
Argument
Variable Type [in/out] Introduce
name
PlcDataB byte[] in X
PlcDataS short[] in X
PlcDataI int[] in X
READ_plc_ver:PLC version
Function Name short READ_plc_ver(…)
Argument
Variable name Type [in/out]
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
RAddress int in X
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
Argument
Variable name Type [in/out] Introduce
PlcData byte[] in X
Argument
Variable name Type [in/out] Introduce
PlcData int[] in X
Version
10.118.12G and
below
The controller
software version
10.118.12G and
before required to
modify its PLC in
order to use
RemoteAPI to
perform cycle
start function.
Below shows the
modification the
cycle start
function in PLC.
Origina
l PLC
Modifie
d PLC
• It is recommended to
add custom
modifications based on
this file.