Hello,
I am trying to dynamically change the TCP of our spindle to be along the bit based on a specified cut depth. We have software that is sending XYZABC coordinates that are normal to the surface we are attempting to mill and we are wanting a pocket cut that follows the shape. If we are able to move the TCP by 1/2 an inch up, we should be able to do this successfully, however when running this code, it does not use the new calculated TCP but rather the one saved in TOOL_DATA[9].
DEF millingSide1 ( )
DECL int count, resetCounter
DECL FRAME millingOffsetTCP, millingOffsetTCPSave
E6POS currentPos
$STOPNOAPROX = FALSE
toolpathPosIndex = 0
robUpdateToolpathArr = FALSE
;FOLD INI;%{PE}
;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
count = 1
;ENDFOLD (USER INI)
;ENDFOLD (INI)
FOR resetCounter = 1 to 10000 STEP 1
ToolpathData[resetCounter] = {X 0,Y 0,Z 0,A 0,B 0,C 0,E1 0,E2 -90,E3 90,E4 0.0,E5 0.0,E6 0.0}
ENDFOR
goHome(1)
WAIT SEC 0
;FOLD TOOLPATH LOADING AND INITIALIZATION
robUpdateToolpathArr = TRUE ;REQUEST POINTS TO BE SENT
WAIT FOR $IN[57] ;SOFTWARE STARTING TO SEND
;MOVE TO SAFE POS
SLIN XP28 WITH $VEL = SVEL_CP(1.0, , LCPDAT32), $TOOL = STOOL2(FP28), $BASE = SBASE(FP28.BASE_NO), $IPO_MODE = SIPO_MODE(FP28.IPO_FRAME), $LOAD = SLOAD(FP28.TOOL_NO), $ACC = SACC_CP(LCPDAT32), $ORI_TYPE = SORI_TYP(LCPDAT32), $APO = SAPO(LCPDAT32), $JERK = SJERK(LCPDAT32), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
SPTP XP25 WITH $VEL_AXIS[1] = SVEL_JOINT(50.0), $TOOL = STOOL2(FP25), $BASE = SBASE(FP25.BASE_NO), $IPO_MODE = SIPO_MODE(FP25.IPO_FRAME), $LOAD = SLOAD(FP25.TOOL_NO), $ACC_AXIS[1] = SACC_JOINT(PPDAT20), $APO = SAPO_PTP(PPDAT20), $GEAR_JERK[1] = SGEAR_JERK(PPDAT20), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
WAIT FOR NOT $IN[57] ;SOFTWARE DONE SENDING
robUpdateToolpathArr = FALSE ;REQUEST POINTS TO NOT BE SENT
;ENDFOLD
millingOffsetTCP = TOOL_DATA[9]
millingOffsetTCP.Z = millingOffsetTCP.Z - softMillingCutDepth
$TOOL = millingOffsetTCP
WHILE count < toolpathArrSizeInt
IF count == 1 THEN
$VEL.CP = 0.3
$APO.CDIS = 0
$ACC.CP = 1
SLIN ToolpathData[count] WITH $TOOL = millingOffsetTCP
toolpathPosIndex = toolpathPosIndex + 1
count = count + 1
WAIT SEC 0
enableSpindle()
WAIT SEC 0
ELSE
$VEL.CP = softToolpathVelocity
$APO.CDIS = 1
$ACC.CP = 1
SLIN ToolpathData[count] WITH $TOOL = millingOffsetTCP C_DIS
toolpathPosIndex = toolpathPosIndex + 1
count = count + 1
ENDIF
ENDWHILE
LIN ToolpathData[count-1]:{X 0,Y 0,Z -150,A 0,B 0,C 0}
WAIT SEC 0
disableSpindle()
WAIT SEC 0
;MOVE TO SAFE POS
SLIN XP26 WITH $VEL = SVEL_CP(1.0, , LCPDAT30), $TOOL = STOOL2(FP26), $BASE = SBASE(FP26.BASE_NO), $IPO_MODE = SIPO_MODE(FP26.IPO_FRAME), $LOAD = SLOAD(FP26.TOOL_NO), $ACC = SACC_CP(LCPDAT30), $ORI_TYPE = SORI_TYP(LCPDAT30), $APO = SAPO(LCPDAT30), $JERK = SJERK(LCPDAT30), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
SPTP XP29 WITH $VEL_AXIS[1] = SVEL_JOINT(50.0), $TOOL = STOOL2(FP29), $BASE = SBASE(FP29.BASE_NO), $IPO_MODE = SIPO_MODE(FP29.IPO_FRAME), $LOAD = SLOAD(FP29.TOOL_NO), $ACC_AXIS[1] = SACC_JOINT(PPDAT23), $APO = SAPO_PTP(PPDAT23), $GEAR_JERK[1] = SGEAR_JERK(PPDAT23), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
;ENDFOLD
goHome(1)
END
Display More
I'm honestly not sure where the error in this is as my program compiles correctly and when I attempt to debug and monitor my millingOffsetTCP values, they are populated correctly, the motion is just using the wrong tool. I am currently running KSS 8.5.8 on a KUKA KRC4 controller, and any help would be much appreciated! Thank you and have a good day.