FB_KinUnlockTrafoParam

FB_KinUnlockTrafoParam 1:

The function block FB_KinUnlockTrafoParam unlocks transformation parameters that have an influence on the position so that they can be written.

Once the kinematics parameters have been unlocked, the PLC has write access via ADSWRITE. The required index group is the object ID and the index offset is the parameter ID. The written parameters are not persistent. Parameters that have no influence on the position (e.g. torques and masses) can be written without calling FB_KinUnlockTrafoParam.

CAUTION

Changing the parameters can lead to discontinuities.

Please note that utmost caution is required. Redefinition of kinematic parameters can lead to position setpoint step changes in the kinematic chain.

After kinematic parameters have been written, writing with FB_LockTrafoParam can be locked again.

VAR_INPUT

VAR_INPUT
    bExecute              : BOOL;
    oidTrafo              : UDINT;
END_VAR

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

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

VAR_OUTPUT

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

bBusy: 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: The output becomes TRUE when the command was executed successfully.

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

nErrorId: 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 and parameter ID required for enabling a transformation parameter and for writing a corresponding new value can be read from the transformation object in the XAE.

FB_KinUnlockTrafoParam 2:
FB_KinUnlockTrafoParam 3:
VAR
    bUserExecuteUnlock     : BOOL;
    fbFB_UnlockTrafoParam  : FB_KinUnlockTrafoParam;
    bUserExecuteWriteParam : BOOL;
    fbADSWRITE             : ADSWRITE;
    oidTrafo               : UDINT := 16#01010170; (*Trafo object id*)
    pidTrafo               : UDINT := 16#05010020; (*parameter id*)
    fParamValue            : LREAL;
END_VAR
fbFB_UnlockTrafoParam(
    bExecute := bUserExecuteUnlock,
    oidTrafo := oidTrafo,
    bBusy=>,
    bDone=>,
    bError=>,
    nErrorId=> );

(*After unlocking new parameter value can be written*)
fbADSWRITE(
    NETID:='' ,
    PORT:= AMSPORT_R0_NCSAF,
    IDXGRP:=oidTrafo ,
    IDXOFFS:= pidTrafo,
    LEN:=SIZEOF(fParamValue) ,
    SRCADDR:= ADR(fParamValue),
    WRITE:=bUserExecuteWriteParam ,
    TMOUT:= ,
    BUSY=> ,
    ERR=> ,
    ERRID=> );