FB_KinCalcTrafo

FB_KinCalcTrafo 1:

The function block FB_KinCalcTrafo is used to calculate the forward or backward transformation, even if no kinematic group has been created with FB_KinConfigGroup.

FB_KinCalcTrafo 2: Inputs

VAR_INPUT
    bExecute              : BOOL;
    bForward              : BOOL;
    oidTrafo              : UDINT;
END_VAR

Name

Type

Description

bExecute

BOOL

The command is triggered by a rising edge at this input.

bForward

BOOL

Determines whether the forward or backward transformation is calculated.

oidTrafo

UDINT

Object ID of the kinematic transformation object. See sample below.

FB_KinCalcTrafo 3: Inputs/outputs

VAR_IN_OUT
    stAxesPosIn           : ARRAY[1..8] OF LREAL;
    stAxesPosOut          : ARRAY[1..8] OF LREAL;
    uMetaInfoIn           : U_KinMetaInfo;
    uMetaInfoOut          : U_KinMetaInfo;
END_VAR

Name

Type

Description

stAxesPosIn

ARRAY[1..8] OF LREAL

Array containing the input positions of the transformation. For the calculation of a forward transformation they represent the joint positions. For the calculation of a backward transformation they represent the Cartesian axis positions.

stAxesPosOut

ARRAY[1..8] OF LREAL

Array containing the result positions of the transformation. For the calculation of a forward transformation they represent the Cartesian axis positions. For the calculation of a backward transformation they represent the joint positions.

uMetaInfoIn

U_KinMetaInfo

In cases where different robot configurations lead to a solution, the preferred solution can be selected (see sample). For kinematics in which this parameter is not required, a dummy variable can be assigned to this input.

uMetaInfoOut

U_KinMetaInfo

If different solutions are possible for a transformation, the solution that was found is specified. For kinematics in which this parameter is not required, a dummy variable can be assigned to this input.

FB_KinCalcTrafo 4: Outputs

VAR_OUTPUT
    bBusy                 : BOOL;
    bDone                 : BOOL;
    bError                : BOOL;
    nErrorId              : UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

The output becomes TRUE when the command is started with bExecute and remains TRUE as long as the function block executes the command. While bBusy is TRUE, no new command is accepted at the inputs. If bBusy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs bDone or bError is set.

bDone

BOOL

The output becomes TRUE when the command was executed successfully.

bError

BOOL

The output bError is set to TRUE, if an error occurred during the command execution.

nErrorId

UDINT

Contains the command-specific error code of the most recently executed command. Details of the error code can be found in the ADS error documentation or in the NC error documentation (error codes from 0x4000).

Sample

The object ID of the transformation is shown in the transformation object under the kinematic channel.

SCARA transformation - sample object ID

FB_KinCalcTrafo 5:
VAR
    fbKinCalcTrafo     : FB_KinCalcTrafo;
    stAxesPosIn        : ARRAY[1..8] OF LREAL;
    stAxesPosOut       : ARRAY[1..8] OF LREAL;
    bUserExecute       : BOOL;
    bUserCalcFwdTrafo  : BOOL;
    uScaraMetaInfoIn : U_KinMetaInfo;
    uScaraMetaInfoOut : U_KinMetaInfo;
END_VAR
uScaraMetaInfoIn.eScara := E_KinMetaInfoScara.scaraLeftArm;

fbKinCalcTrafo(
    bExecute := bUserExecute,
    bForward := bUserCalcFwdTrafo,
    oidTrafo := 16#01010070,
    stAxesPosIn := stAxesPosIn,
    stAxesPosOut := stAxesPosOut,
    uMetaInfoIn:= uScaraMetaInfoIn ,
    uMetaInfoOut:= uScaraMetaInfoOut,
    bBusy=> ,
    bDone=> ,
    bError=> ,
    nErrorId=> );