Mitsubishi Electric MELFA CR800-D Series User Manual page 64

Industrial robot
Hide thumbs Also See for MELFA CR800-D Series:
Table of Contents

Advertisement

4 Calibration assistance function
Return
'
'ecognition result of vision and Correspondence of workpiece coordinate
*VSResSort
' X axis linear equation (ax+by+c=0)
Ma = Cos(PVS.C)
Mb = Sin(PVS.C)
Mc = -Ma*PVS.X - Mb*PVS.Y
' Y axis linear equation (-bx+ay+d=0)
Md = Mb*PVS.X - Ma*PVS.Y
'
For M1=1 To 4 Step 1
Ptmp = PV(M1)
If (Ma*Ptmp.X + Mb* Ptmp.Y + Mc) < 0 Then
If (-Mb*Ptmp.X + Ma* Ptmp.Y + Md) < 0 Then
PVtmp(1) = Ptmp
Else
PVtmp(3) = Ptmp
EndIf
Else
If (-Mb*Ptmp.X + Ma* Ptmp.Y + Md) < 0 Then
PVtmp(2) = Ptmp
Else
PVtmp(4) = Ptmp
EndIf
EndIf
Next M1
'
For MI=1 To 4 Step 1
PV(MI) = PVtmp(MI)
Next MI
Return
'
'### Camera angle / scale calculation ###
*SCalcAngleScale
'//First point shooting
Mvs PC0*POFS(1)
Dly 0.5
GoSub *VSTRG
PVS1=PVS
'//Second point shooting
Mvs PC0*POFS(2)
Dly 0.5
GoSub *VSTRG
PVS2=PVS
'//Camera angle calculation (optical axis rotation)
MRDX=POFS(2).X-POFS(1).X
MRDY=POFS(2).Y-POFS(1).Y
MVDX=PVS1.X-PVS2.X
MVDY=PVS1.Y-PVS2.Y
MVSC=Atn2(MRDY,MRDX)-Atn2(MVDY,MVDX)
PVSC=P_Zero
PVSC.C=MVSC
'//Scale value calculation(Distance per pixel)
MPL=Sqr(MVDX*MVDX+MVDY*MVDY)
MRL=Sqr(MRDX*MRDX+MRDY*MRDY)
MScale=MRL/MPL
Return
'
'### Move mark to camera center ###
*SMovCenter
'// Center position imaging
MRTRY = 0
MFIN = 0
4-54 Workpiece coordinate calibration
' ax+by+c < 0 && -bx+ay+d < 0
' ax+by+c < 0 && -bx+ay+d >= 0
' ax+by+c >= 0 && -bx+ay+d < 0
' ax+by+c >= 0 && -bx+ay+d >= 0
' Image acquisition, check the mark.Assign mark position to PV
' Image acquisition, check the mark.Assign mark position to PV
'Retry counter initialization
' Initialize end flag

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents