KUKA 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 the related explanation.
&ACCESS RVP
&PARAM EDITMASK = *
&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
DEF MSR_METRICS_SAMPLE( )
;FUNCTION: Test Metrics
INT MSR_Continuous_Mode,Measure_Result,MSR_Status
MSR_Continuous_Mode = 0
Measure_Result = 0
Failed_Count[1] = 0
Failed_Count[2] = 0
Failed_Count[3] = 0
MSR_Init_Socket("XML_Kuka_MSR",20,30,60)
MSR_Start_Measure(1,"Piece01","ABC",2,10,20,30,40,50,60,70,80,MSR_Continuous_Mode,MSR_Status)
IF MSR_Status <> 8100 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
MSR_Set_Piece_Info(1,"Piece01",MSR_Status)
IF MSR_Status <> 8103 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
;FOLD PTP P3 CONT Vel=100 % PDAT3 Tool[1] Base[0];%{PE}
;FOLD Parameters ;%{h}
;Params IlfProvider=kukaroboter.basistech.inlineforms.movement.old; Kuka.IsGlobalPoint=False; Kuka.PointName=P3; Kuka.BlendingEnabled=True; Kuka.MoveDataPtpName=PDAT3; Kuka.VelocityPtp=100; Kuka.CurrentCDSetIndex=0; Kuka.MovementParameterFieldEnabled=True; IlfCommand=PTP
;ENDFOLD
$BWDSTART = FALSE
PDAT_ACT = PPDAT3
FDAT_ACT = FP3
BAS(#PTP_PARAMS, 100.0)
;SET_CD_PARAMS (0)
PTP XP3 C_Dis
;ENDFOLD
MSR_Measure_Feature(1,1,MSR_Status)
IF MSR_Status <> 8101 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
;FOLD PTP P2 CONT Vel=100 % PDAT2 Tool[1] Base[0];%{PE}
;FOLD Parameters ;%{h}
;Params IlfProvider=kukaroboter.basistech.inlineforms.movement.old; Kuka.IsGlobalPoint=False; Kuka.PointName=P2; Kuka.BlendingEnabled=True; Kuka.MoveDataPtpName=PDAT2; Kuka.VelocityPtp=100; Kuka.CurrentCDSetIndex=0; Kuka.MovementParameterFieldEnabled=True; IlfCommand=PTP
;ENDFOLD
$BWDSTART = FALSE
PDAT_ACT = PPDAT2
FDAT_ACT = FP2
BAS(#PTP_PARAMS, 100.0)
;SET_CD_PARAMS (0)
PTP XP2 C_Dis
;ENDFOLD
MSR_Measure_Feature(1,1,MSR_Status)
IF MSR_Status <> 8101 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
;FOLD PTP P4 CONT Vel=100 % PDAT4 Tool[1] Base[0];%{PE}
;FOLD Parameters ;%{h}
;Params IlfProvider=kukaroboter.basistech.inlineforms.movement.old; Kuka.IsGlobalPoint=False; Kuka.PointName=P4; Kuka.BlendingEnabled=True; Kuka.MoveDataPtpName=PDAT4; Kuka.VelocityPtp=100; Kuka.CurrentCDSetIndex=0; Kuka.MovementParameterFieldEnabled=True; IlfCommand=PTP
;ENDFOLD
$BWDSTART = FALSE
PDAT_ACT = PPDAT4
FDAT_ACT = FP4
BAS(#PTP_PARAMS, 100.0)
;SET_CD_PARAMS (0)
PTP XP4 C_Dis
;ENDFOLD
MSR_Measure_Feature(1,1,MSR_Status)
IF MSR_Status <> 8101 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
MSR_End_Measure(1,Measure_Result,Failed_Count[],MSR_Status)
IF MSR_Status <> 8102 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
MSR_View_Piece_Data(1,"Piece01",MSR_Status)
IF MSR_Status <> 8104 THEN
MSR_LOG("Run failed!")
HALT;
ENDIF
WAIT SEC 1
END
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 | ||
|---|---|---|---|
Initialize communication |
|
||
Start measurement task |
|
||
Input part to Mech-Metrics |
|
||
Move the robot to a specified position and perform feature measurement |
|
||
End measurement |
|
||
Query history data |
|