FB_VN_ReadCalibrationPattern

FB_VN_ReadCalibrationPattern 1:

This FB reads calibration pattern reference points from an xml file on the targte pc.

Syntax

Definition:

FUNCTION_BLOCK FB_VN_ReadCalibrationPattern
VAR_INPUT
    sFilePath       : STRING;
    ipDestContainer : Reference To ITcVnContainer;
    bRead           : BOOL;
    nTimeout        : TIME;
END_VAR
VAR_OUTPUT
    bBusy           : BOOL;
    bError          : BOOL;
    nErrorId        : UDINT;
END_VAR

FB_VN_ReadCalibrationPattern 2: Inputs

Name

Type

Default

Description

sFilePath

STRING

 

Full path of the file or relative path to the default directory on the target pc

ipDestContainer

Reference To ITcVnContainer

 

Returns a container with the pattern points (ContainerType_Vector_TcVnPoint3_REAL)

bRead

BOOL

 

Reading the file is triggered by a rising edge at this input.

nTimeout

TIME

VISION_ADS_TIMEOUT

Indicates the time before the function is cancelled.

FB_VN_ReadCalibrationPattern 3: Outputs

Name

Type

Description

bBusy

BOOL

This output remains TRUE until the function block has executed a command, but at the longest for the duration supplied to the 'nTimeout' input. While bBusy = TRUE, no new command will be accepted at the inputs.

bError

BOOL

This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrorId’. If the function block has a timeout error, 'bError' is TRUE and 'nErrorId' is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

nErrorId

UDINT

Contains the ADS error code or the command-specific error code of the last executed command. Is reset to 0 by the execution of a command at the inputs.

Further information

The function block FB_VN_ReadCalibrationPattern loads the description of an individual calibration pattern asynchronously from a file.

FB_VN_ReadCalibrationPattern 4:

Loading of modified containers

When loading containers, the vision service caches the data internally. Loading changed containers is therefore not possible in the standard system. To do this, adjust the cache settings or see the sample Serial loading of images to the PLC for an alternative.

Parameter

Some parameters are described centrally in the section File Access Parameters.

Loaded container (return value)

The loaded container with the reference points of the calibration pattern can be reached via the interface pointer ipPatternReferencePoints after a successful read operation.

Application

Loading the reference points of a calibration pattern from the path C:\TcVision\CalibrationPatternReferencePoints.xml looks like this, for example:

fbReadCalibrationPattern(
    sFilePath       := 'C:\TcVision\CalibrationPatternReferencePoints.xml',
    ipDestContainer := ipPatternReferencePoints,
    bRead           := TRUE,
    nTimeout        := T#500MS);

IF NOT fbReadCalibrationPattern.bBusy AND NOT fbReadCalibrationPattern.bError THEN
    // reference points are accessible in ipPatternReferencePoints
END_IF

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision