FB_ConfigKinGroup

FB_ConfigKinGroup 1:

The Function Block FB_ConfigKinGroup configures axes to the kinematic transformation. These are axes for the ACS (Axis Coordinate System, Joint) and MCS (Machine Coordinate System, Cartesian). The Function Block takes the ACS and MCS Axes defined in the stAxesList and configures them into the kinematic group of stKinRefIn.

VAR_INPUT

VAR_INPUT
    bExecute              : BOOL;
    bCartesianMode        : BOOL;
END_VAR

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

bCartesianMode: If FALSE, the ACS (Axis Coordinate system, Joint) axes can be moved directly. If TRUE, movement in the MCS (Cartesian) axes will be transformed into the ACS (Joint) axes. The ACS axes cannot be moved directly.

VAR_IN_OUT

VAR_IN_OUT
    stAxesList            : ST_KinAxes;
    stKinRefIn            : NciChannelToPlc;
END_VAR

stAxesList: Determines the ACS and MCS axes included in the configuration. See ST_KinAxes.

stKinRefIn: Determines the kinematic group of the configuration. See NciChannelToPlc.

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 as long as the function block is executing the command. While bBusy is TRUE, no new instructions will be accepted at the inputs. When 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 if the command succeeded.

bError: The output bError becomes true if an error occurs as the command is executed.

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

Example

VAR
    io_X                  : AXIS_REF;
    io_Y                  : AXIS_REF;
    io_Z                  : AXIS_REF;
    io_M1                 : AXIS_REF;
    io_M2                 : AXIS_REF;
    io_M3                 : AXIS_REF;
    out_stPlcToKin AT %Q* : NciChannelFromPlc;
    out_stPlcToItp AT %Q* : NciChannelFromPlc;
    fbConfigKinGroup      : FB_ConfigKinGroup;
    stAxesConfig          : ST_KinAxes;
    bAllAxesReady         : BOOL;
    bExecuteConfigKinGroup: BOOL;
    bUserConfigKinGroup   : BOOL;
    bUserCartesianMode    : BOOL; := TRUE;
    (*true: cartesian mode - false: direct mode (without transformation) *)
END_VAR
(* read the IDs from the cyclic axis interface so the axes can mapped later to the kinematic group *)
stAxesConfig.nAxisIdsAcs[1] := io_M1.NcToPlc.AxisId;
stAxesConfig.nAxisIdsAcs[2] := io_M2.NcToPlc.AxisId;
stAxesConfig.nAxisIdsAcs[3] := io_M3.NcToPlc.AxisId;
stAxesConfig.nAxisIdsMcs[1] := io_X.NcToPlc.AxisId;
stAxesConfig.nAxisIdsMcs[2] := io_Y.NcToPlc.AxisId;
stAxesConfig.nAxisIdsMcs[3] := io_Z.NcToPlc.AxisId;

IF bAllAxesReady AND bUserConfigKinGroup THEN
    bExecuteConfigKinGroup := TRUE;
ELSE
    bExecuteConfigKinGroup := FALSE;
END_IF

fbConfigKinGroup(
    bExecute       := bExecuteConfigKinGroup ,
    bCartesianMode := bUserCartesianMode ,
    stAxesList     := stAxesConfig,
    stKinRefIn     := in_stKinToPlc );

Kinematic Group State

FB_ConfigKinGroup 2:
FB_ConfigKinGroup 3:

Enabling Configuration

The ACS axes must be enabled for the state to reach KinStatus_Ready. If the ACS Axes are not enabled, enable the axes and then call FB_ConfigKinGroup or FB_ResetKinGroup.