VCal陳述式

套用至
視覺校正

說明
您可透過VCal從SPEL+程式執行視覺校正。

用途

VCal  Calibration [, var]
Calibration
欲執行校正的名稱
var
表示傳回狀態的整數變數。可以忽略。

數值
var中的傳回狀態。

若使用者按下[OK]按鈕,var將含有「1」。

若使用者按下[取消]按鈕,var將含有「0」。

詳細說明
執行校正前,需從Vision Guide視窗設定或使用VCreateCalibration建立校正定義。此外,校正點必須已經過教導,或可使用控制器中,與校正所需點位資料名稱相同的點位檔案。若Epson RC+檢視此點位檔案,其將會使用檔案中的點位。下參閱下列範例。

透過VCal執行校正後,需呼叫VSave以儲存新的校正資料。

NOTE:


校正用攝影機連接至緊湊型視覺時,需將Epson RC+連接至機器人控制器。否則,命令會發生執行錯誤。

範例1
在此範例1中,停用AutoReference屬性並啟用AutoCamPoints屬性,以執行J6行動攝影機校正。

Function CalMobileJ6
    String cal$

    cal$ = "mycal"
    VCreateCalibration 1, cal$
    VSet cal$.CameraOrientation, VISION_CAMORIENT_MOBILEJ6
    VSet cal$.TargetSequence, "calSeq"
    VSet cal$.AutoReference, False
    VSet cal$.AutoCamPoints, True
    VCalPoints cal$
    VCal cal$
    VSave
Fend

範例2
在此範例2中,為校正固定向下式攝影機,使用已校正行動攝影機的九個點位辨識結果,而非執行教導。

Function CalFixedCamera
    Integer i, status
    Boolean found
    Real x, y, u
    String obj$
    ' "mobileCal" is a sequence with 9 blobs
    ' that uses a mobile calibration.
    ' First we search with the mobile camera
    Jump mobileCamView
    VRun mobileCal
    VGet mobileCal.AllFound, found
    If Not found Then
        MsgBox "Could not find all targets"
        Exit Function
    EndIf
    For i = 1 TO 9
        obj$ = "blob0" + Str$(i)
        VGet mobileCal.obj$.RobotXYU, found, x, y, u
        ' Save each target point in robot coordinates
        P(i) = XY(x, y, 0, 0)
    Next i
    ' Save the points for VCal to use
    ' Note that "fixed" is the name of the calibration
    SavePoints "fixed.pts"
    Jump clearFixed
    ' Calibrate the fixed camera calibration scheme
    VCal fixed, status
    If status = 1 Then
        VSave
    EndIf
Fend

參考
ShowConfirmation屬性、VCalPoints、VCreateCalibration、視覺序列、VSave