ABB Inline Measurement Example Program
Program Introduction
Description |
You trigger Mech-Metrics from the robot side to perform measurement using Mech-MSR and return the measurement results to Mech-Metrics. |
File path |
You can navigate to the installation directory of Mech-MSR and Mech-Metrics by using the |
Resource requirements |
Mech-MSR solution and Mech-Metrics project |
Prerequisites |
|
| This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario. |
Program Description
The following is the code of the MSR_Metrics_Sample example program and its related explanation.
MODULE MSR_Metrics_Sample
LOCAL CONST jointtarget path1:=[[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL CONST jointtarget path2:=[[0,0,0,0,100,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL CONST jointtarget path3:=[[0,0,0,0,110,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL VAR num MSR_Status:=0;
LOCAL VAR num outvalue:=0;
LOCAL VAR num measure_result:=0;
LOCAL VAR num FailedCount{3}:=[0,0,0];
PROC MSR_Metric_Test()
AccSet 50,50;
!set the velocity parameters
VelSet 50,1000;
!Init socket! Modify IP address;
MSR_Init_Socket "127.0.0.1",4000,300;
MSR_Open_Socket MSR_Status;
IF MSR_Status=-99 THEN
TPWrite "MSR: Communication Error";
STOP;
ENDIF
WaitTime 1;
MSR_Start_Measure 1,"Piece01","ABC",2,1,2,3,4,5,6,7,8,outvalue,MSR_Status;
IF MSR_Status<> 8100 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MSR_Set_Piece_Info 1,"ABC",MSR_Status;
IF MSR_Status<> 8103 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MoveAbsJ path1\NoEOffs,v3000,fine,tool0;
MSR_Measure_Feature 1,1,MSR_Status;
IF MSR_Status<> 8101 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MoveAbsJ path2\NoEOffs,v3000,fine,tool0;
MSR_Measure_Feature 1,1,MSR_Status;
IF MSR_Status<> 8101 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MoveAbsJ path3\NoEOffs,v3000,fine,tool0;
MSR_Measure_Feature 1,1,MSR_Status;
IF MSR_Status<> 8101 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MSR_End_Measure 1,measure_result,FailedCount,MSR_Status;
IF MSR_Status<> 8102 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MSR_View_Piece_Data 1,"ABC",MSR_Status;
IF MSR_Status<> 8104 THEN
TPWrite "MSR: RUN Error";
STOP;
ENDIF
MSR_Close_Socket;
stop;
ENDPROC
ENDMODULE
The table below explains the above example program. In the above code, the lines that are commented out start with !. The following table does not explain what is commented out.
| Workflow | Code and description | ||
|---|---|---|---|
Define variables |
|
||
Set acceleration and velocity |
|
||
Initialize the communication |
|
||
Establish the communication |
|
||
Start measurement task |
|
||
Input part to Mech-Metrics |
|
||
Move the robot to a specified position and perform feature measurement |
|
||
Stop Measurement Task |
|
||
Query history data |
|
||
Close the communication |
|