FANUC Inline Measurement Program
Program Introduction
Description |
The robot triggers Mech-Metrics to perform measurement using Mech-MSR and return the measurement results to Mech-Metrics. |
File path |
In the installation directory of Mech-MSR and Mech-Metrics: |
Resource requirements |
Mech-MSR solution and Mech-Metrics project |
Prerequisites |
|
| This example program is provided for reference only. Modify the program according to the actual scenario before use. Do not use this program directly. |
Program Explanation
The following is the code of the MSR_Metrics_Sample1 example program and the related explanation.
1: !-------------------------------- ;
2: !FUNCTION: MSR_Metrics_Sample1 ;
3: !Mech-Mind, 2024-05-27 ;
4: !-------------------------------- ;
5: ;
6: !set current uframe NO. to 0 ;
7: UFRAME_NUM=0 ;
8: !set current tool NO. to 1 ;
9: UTOOL_NUM=1 ;
10: !move to robot home position ;
11: J P[4] 100% FINE ;
12: !Init Socket!Modify IP Address ;
13: CALL MSR_INIT_SKT('8','192.168.1.20',30000,5) ;
14: !Set Custom Values ;
15: CALL MSR_MEAS_PAR(0,0,0,0,0,0,0,0) ;
16: !Start Measurement Task ;
17: CALL MSR_ST_MEAS(1,1,2,10,10,53) ;
18: !check whether metrics project ;
19: !has been triggered successfully ;
20: IF (R[53]<>8100),JMP LBL[99] ;
21: !Import Part ID During ;
22: !Measurement ;
23: CALL MSR_SET_WP(1,2,53) ;
24: !check whether Part ID has ;
25: !been imported successfully ;
26: IF (R[53]<>8103),JMP LBL[99] ;
27: !move to 1st image-capturing ;
28: !position ;
29: J P[1] 100% FINE ;
30: !Set Robot_Id,Index ;
31: !R No.2:MM Status ;
32: CALL MSR_MEAS_FEAT(1,3,53) ;
33: !check whether feature measureme- ;
34: !nt has been run successfully ;
35: IF (R[53]<>8101),JMP LBL[99] ;
36: !move to 2ed image-capturing ;
37: !position ;
38: J P[2] 100% FINE ;
39: !Set Robot_Id,Index ;
40: !R No.2:MM Status ;
41: CALL MSR_MEAS_FEAT(1,3,53) ;
42: !check whether feature measureme- ;
43: !nt has been run successfully ;
44: IF (R[53]<>8101),JMP LBL[99] ;
45: !move to 3rd image-capturing ;
46: !position ;
47: J P[3] 100% FINE ;
48: !Set Robot_Id,Index ;
49: !R No.2:MM Status ;
50: CALL MSR_MEAS_FEAT(1,3,53) ;
51: !check whether feature measureme- ;
52: !nt has been run successfully ;
53: IF (R[53]<>8101),JMP LBL[99] ;
54: CALL MSR_END_MEAS(1,11,12,13,14,53) ;
55: !check whether metrics project ;
56: !has been ended successfully ;
57: IF (R[53]<>8102),JMP LBL[99] ;
58: !Query Part Historical Data ;
59: CALL MSR_VIEW_WP(1,2,53) ;
60: !check whether part historical ;
61: !data has been viewed ;
62: !successfully ;
63: IF (R[53]<>8104),JMP LBL[99] ;
64: WAIT 1.00(sec) ;
65: END ;
66: ;
67: LBL[99:handling error] ;
68: !add error handling logic here ;
69: !according to different ;
70: !error codes ;
71: !e.g.: R[53]=-99 means ;
72: !failed to open socket ;
73: PAUSE ;
The following table explains the logic of the preceding program. In the preceding code, the commented-out content starts with ! and is not explained in the table below.
| Process | Code and Description | ||||
|---|---|---|---|---|---|
Set the coordinate systems |
|
||||
Move to the specified position |
|
||||
Initialize the communication |
|
||||
Set custom parameters |
|
||||
Start the measurement |
|
||||
Import the part SN during the measurement |
|
||||
Move the robot to the specified positions and perform feature measurement |
|
||||
End the measurement |
|
||||
Query historical data |
|
||||
End the program and handle errors |
|