I have this program where it measures the tool lenght of a tool attatched to the robot flange. However when I try to measure a tool it has an overshoot of 50mm to the tool lenght. So my tool is 200mm but the measurment is 250mm.... does anyone know why this is happening? explenation of code: at the starting position for the move along the z axis it get the Z location, then it moves down until it hits a button, where it records that location on the z axis, this location is deducted from the first measured location. this measurment gives a 50mm difference.
Code
&ACCESS RVP
&REL 12
&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
&PARAM EDITMASK = *
DEF Toolsetter_measure8( )
;FOLD INI
;FOLD BASISTECH INI
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
INTERRUPT ON 3
BAS (#INITMOV,0 )
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
;Make your modifications here
;ENDFOLD (USER INI)
;ENDFOLD (INI)
;FOLD PTP HOME Vel=30 % DEFAULT Tool[1] Base[0];%{PE}%R 8.3.22,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:30, 7:DEFAULT
$BWDSTART=FALSE
PDAT_ACT=PDEFAULT
FDAT_ACT=FHOME
BAS(#PTP_PARAMS,30)
PTP XHOME
;ENDFOLD ;Home position ;Home Position
;FOLD PTP P1 Vel=30 % PDAT1 Tool[0] Base[0];%{PE}%R 5.5.31,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P1, 3:, 5:30, 7:PDAT1
$BWDSTART=FALSE
PDAT_ACT=PPDAT1
FDAT_ACT=FP1
BAS(#PTP_PARAMS,30)
PTP XP1
;ENDFOLD ;Starting location Z axis
ST=$POS_ACT
StartPos=ST.z
INTERRUPT DECL 1 WHEN $IN[1]==TRUE DO TOOLM() ;Declare interrupt
MOVEZ() ;Start Z axis movement
INTERRUPT OFF 1 ;Turn off interrupt
;FOLD PTP HOME Vel=30 % DEFAULT Tool[1] Base[0];%{PE}%R 8.3.22,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:30, 7:DEFAULT
$BWDSTART=FALSE
PDAT_ACT=PDEFAULT
FDAT_ACT=FHOME
BAS(#PTP_PARAMS,30)
PTP XHOME
;ENDFOLD ;Return to home
$OUT[1]=FALSE ;Deactivate output 1
END
DEF MOVEZ() ;Moving the robot from position 1 to position 2 on the Z axis
INTERRUPT ON 1 ;Activate interrupt
;FOLD PTP P3 Vel=30 % PDAT3 Tool[0] Base[0];%{PE}%R 5.5.31,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P3, 3:, 5:30, 7:PDAT3
$BWDSTART=FALSE
PDAT_ACT=PPDAT3
FDAT_ACT=FP3
BAS(#PTP_PARAMS,30)
PTP XP3
;ENDFOLD ;End location for Z axis
;FOLD WAIT Time= 0.0 sec;%{PE}%R 8.3.22,%MKUKATPBASIS,%CWAIT,%VWAIT,%P 2:0.0
WAIT SEC 0.0
;ENDFOLD ;Wait for interrupt
END
DEF TOOLM() ;Subroutine for toolsetter
INTERRUPT OFF 1 ;Deactivate interrupt
BRAKE ;Stop robotarm movement
Z1=$POS_ACT
ToolLenght_1=ToolCorecction-Z1.Z
$OUT[1]=TRUE ;turn on output 1
;FOLD WAIT Time= 3 sec;%{PE}%R 5.4.33,%MKUKATPBASIS,%CWAIT,%VWAIT,%P 2:3
WAIT SEC 3
;ENDFOLD ;Wait for 3 seconds
RESUME ;Continue program
END
Display More
Code
DEFDAT Toolsetter_measure8
;FOLD EXTERNAL DECLARATIONS;%{PE}%MKUKATPBASIS,%CEXT,%VCOMMON,%P
;FOLD BASISTECH EXT;%{PE}%MKUKATPBASIS,%CEXT,%VEXT,%P
EXT BAS (BAS_COMMAND :IN,REAL :IN )
DECL INT SUCCESS
;ENDFOLD (BASISTECH EXT)
;FOLD USER EXT;%{E}%MKUKATPUSER,%CEXT,%VEXT,%P
;Make here your modifications
;ENDFOLD (USER EXT)
;ENDFOLD (EXTERNAL DECLARATIONS)
DECL E6POS XP1={X 1193.23206,Y 87.6306686,Z 1551.323,A -85.5697632,B 33.723629,C -104.408302,S 6,T 51,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "P4 ",POINT2[] "P4 ",CP_PARAMS[] "CPDAT0 ",PTP_PARAMS[] "PDAT5 ",CONT[] " ",CP_VEL[] "2.0 ",PTP_VEL[] "30 ",SYNC_PARAMS[] "SYNCDAT ",SPL_NAME[] "S0 "}
DECL FDAT FP1={TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
DECL PDAT PPDAT1={VEL 100.0,ACC 100.0,APO_DIST 100.0}
DECL E6POS XP2={X 1175.51001,Y 66.8519516,Z 1534.073,A -83.5087433,B 33.6255913,C -89.470047,S 6,T 51,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
DECL FDAT FP2={TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
DECL PDAT PPDAT2={VEL 100.0,ACC 100.0,APO_DIST 100.0}
DECL E6POS XP3={X 1193.26697,Y 87.6266327,Z -107.409897,A -85.5685577,B 33.716301,C -104.404999,S 6,T 17,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
DECL FDAT FP3={TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
DECL PDAT PPDAT3={VEL 100.0,ACC 100.0,APO_DIST 100.0}
DECL PDAT PPDAT4={VEL 100.0,ACC 100.0,APO_DIST 100.0}
DECL E6POS XP4={X 1339.78796,Y -287.258301,Z 1390.67798,A 94.3873367,B -33.7286797,C -75.4515076,S 6,T 51,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
DECL FDAT FP4={TOOL_NO 1,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
DECL PDAT PPDAT5={VEL 100.0,ACC 20.0,APO_DIST 100.0}
DECL REAL StartPos= 1551
DECL REAL ToolLenght_1 = 200
DECL REAL ToolCorecction = 1551
ENDDAT
Display More