KUKA电伺服机器人焊点位置补偿示意图:
GLOBALDEF Initialize (TEACH_POS : IN,cont:IN )初始化
初始化示教位置
DECLE6Pos TEACH_POS
DECL SG_Cont_T cont
CONTINUE
$ADVANCE = 3
SG_ExtaxActive=ServoGun[SG_ActiveGunNumber].ExtAxNumber
SG_ActiveWeldTimer =ServoGun[SG_ActiveGunNumber].WeldTimerIndex
bckupSetSG_AxVal()
–获得当前点的外部轴速度加速度—逼近$APO.CPTP和提前运行$RED_VEL
SGE_InitErrorHandler()
IF(ServoGun[SG_ActiveGunNumber].ExtAxNumber>0)then
SGA_SensorReset()
ENDIF
; ------初始化点-----------
P_Part=SGL_CALC_POS(TEACH_POS, ServoGun[SG_ActiveGunNumber].TipCorrection, 0)----获得焊接点位置
P_Approx=P_Part 位置转移/传输
P_Forcelim=P_Part 位置转移/传输
P_Pressure=P_Part
P_Weld=P_Part 焊接位置
P_Ret=P_Part
SG_SpotHelper=P_Part
SG_PartPos = SGL_GET_AXIS_VALUE(TEACH_POS); 力模式下可能的极板接触位置
END;
GLOBALDEFFCTE6POS SGL_CALC_POS(CURRENT_POS :IN, TipCorrection:IN, TouchDiff:IN)
TouchDiff=0 执行焊接时
CURRENT_POS = TEACH_POS
TipCorrection = ServoGun[SG_ActiveGunNumber].TipCorrection=true电极校正
SGL_CALC_START_POS
REAL TouchDiff, wearflex, wearfix, TouchOffset
E6POS CURRENT_POS,RETURNED_POS
BOOL TipCorrection
IF(TipCorrection)THEN TipCorrection=true电极校正
wearflex = SG_WearFlex[SG_ActiveGunNumber] +SG_TipSeating_mm[SG_ActiveGunNumber]
wearflex弯曲磨损量由铣削后测量出来, SG_TipSeating_mm[1]电极坐值
wearfix = SG_WearFix[SG_ActiveGunNumber] +(SG_TipSeating_mm[SG_ActiveGunNumber]/2)
wearfix磨损修复由铣削后测量出来
ELSE ---没有使用校正
wearflex=0.0
wearfix= 0.0
ENDIF
X方向的补偿改变坐标 –使用BASE坐标
SG_Helpframe=SGL_CALC_TCP_POS(TouchDiff,wearfix) ---计算位置值
RETURNED_POS=CURRENT_POS:SG_Helpframe -----补偿值X方向的坐标
转移外部轴和S,T坐标值,用来没有激活外部轴时
RETURNED_POS.E1=CURRENT_POS.E1
RETURNED_POS.E2=CURRENT_POS.E2
RETURNED_POS.E3=CURRENT_POS.E3
RETURNED_POS.E4=CURRENT_POS.E4
RETURNED_POS.E5=CURRENT_POS.E5
RETURNED_POS.E6=CURRENT_POS.E6
RETURNED_POS.S=CURRENT_POS.S
RETURNED_POS.T=CURRENT_POS.T
TouchOffset =(wearflex+wearfix-TouchDiff)* SG_ClosingAxDir
计算偏差值
SG_ClosingAxDir=-1
TouchDiff=0 执行焊接时
Wearflex 弯曲磨损
Wearfix 电极磨损
改变补偿焊接点的外部轴E1
SWITCH SG_ExtaxActive SG_ExtaxActive=1
Case 1
RETURNED_POS.E1=CURRENT_POS.E1+TouchOffset
Case 2
RETURNED_POS.E2=CURRENT_POS.E2+TouchOffset
Case 3
RETURNED_POS.E3=CURRENT_POS.E3+TouchOffset
Case 4
RETURNED_POS.E4=CURRENT_POS.E4+TouchOffset
Case 5
RETURNED_POS.E5=CURRENT_POS.E5+TouchOffset
Case 6
RETURNED_POS.E6=CURRENT_POS.E6+TouchOffset
ENDSWITCH
RETURN (RETURNED_POS) 反馈返回坐标值
ENDFCT;
GLOBALDEFFCTE6POS SGL_CALC_TCP_POS(touchDiff:IN, wearFix:IN)
计算补偿值touchDiff=0, wearFix电极磨损
SGL_CALC_TCP_START_POS
REAL touchDiff, wearFix
E6POS RETURN_HELPFRAME
DECL SG_DIRECTIONTYP_T realDirectio
RETURN_HELPFRAME=$NULLFRAME坐标清0
realDirection = ServoGun[SG_ActiveGunNumber].GunDirection
GunDirection #PX --枪移动方向
IF((FDAT_ACT.IPO_FRAME == #TCP) AND SG_RevFixedGunDirection)THEN
-------------- FDAT_ACT.IPO_FRAME=#BASE 所以此IF语句暂时不执行-------
realDirection =SG_RevToolDirection(ServoGun[SG_ActiveGunNumber].GunDirection)
ENDIF
--------------end---------------------
SWITCH realDirection realDirection=#PX
CASE #NX
RETURN_HELPFRAME.X=-wearFix+touchDiff
CASE #NY
RETURN_HELPFRAME.Y=-wearFix+touchDiff
CASE #NZ
RETURN_HELPFRAME.Z=-wearFix+touchDiff
CASE #PX----------本次机器人执行的补偿数据touchDiff=0
RETURN_HELPFRAME.X=wearFix-touchDiff 直接用磨损值来补偿X方向
CASE #PY
RETURN_HELPFRAME.Y=wearFix-touchDiff
CASE #PZ
RETURN_HELPFRAME.Z=wearFix-touchDiff
ENDSWITCH
RETURN (RETURN_HELPFRAME)
ENDFCT
全部0条评论
快来发表一下你的评论吧 !