VCal Statement

Applies To
Vision Calibration

Description
VCal enables you to run a vision calibration from a SPEL+ program.

Usage

VCal  Calibration [, var]
Calibration
Name of the Calibration to be calibrated
.
var
Optional. Integer variable that will contain the return status.

Values
Returns status in var.

If the user clicks [OK] button, var will contain “1”.

If the user clicks [Cancel] button, var will contain “0”.

Remarks
The calibration definition must be set up from the Vision Guide window or created using VCreateCalibration before a calibration will run. Also, the calibration points must already be taught, or you can use a point file in the Controller with the same name as the calibration that has the point data required for calibration. If Epson RC+ sees this point file, it will use the points in the file. See the following example.

After executing a calibration with VCal, you must call VSave to save the new calibration data.

Note:
When the camera to be used for the calibration is connected to Compact Vision, Epson RC+ needs to be connected to the Robot Controller. Otherwise, the command will result in an execution error.

Example 1
In this example 1, disable the AutoReference property and enable the AutoCamPoints property to perform calibration of the mobile J6 camera.

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

Example 2
In this example 2, use a recognition result of nine points using a calibrated mobile camera insteead of implementing teaching to calibrate a fixed downward camera.

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

See Also
ShowConfirmation Property, VCalPoints, VCreateCalibration, Vision Sequences, VSave