FB_KinPresetRotation

FB_KinPresetRotation 1:

The function block FB_KinPresetRotation is used to set the rotational state.

The rotational state is not persistent and must be reset after a TwinCAT restart or if a path is started after an ACS axis movement (direct mode).

FB_KinPresetRotation 2:

Extended rotation range

  • For a unique solution the standard rotation range is limited to:
  1. Rotation1: -180 to 180 degrees,
  2. Rotation2: -90 to 90 degrees,
  3. Rotation3: -180 to 180 degrees.
  • In some 6-axis applications it is desirable to be able to rotate beyond this rotation range.
    The function blocks FB_KinExtendedRotationRange and FB_KinPresetRotation enable the rotational state to be extended, saved and restored beyond the default values.

FB_KinPresetRotation 3: Inputs

VAR_INPUT
    bExecute       : BOOL;
    oidTrafo       : UDINT;
    stRotation     : ARRAY[1..3] OF LREAL;
END_VAR

Name

Type

Description

bExecute

BOOL

The command is executed with a rising edge.

oidTrafo

UDINT

Object ID (OTCID) of the kinematic transformation object.

Example: Equivalent rotations (same tool orientation)

Rotation1:=   -180              Rotation1:=   -180

Rotation2:=    45                Rotation2:=     45

Rotation3:=    157.95         Rotation3:=   -202.05

FB_KinPresetRotation must be used before FB_KinConfigGroup or FB_KinCalcTrafo perform the forward transformation.

FB_KinPresetRotation 4:

To use the extended rotation range with FB_KinCalcTrafo(bForward:=TRUE) without a kinematic group, the meta information uMetaInfo.aData[4] := 1 must be set.

FB_KinPresetRotation 5: Inputs/outputs

VAR_IN_OUT
    stRotation     : ARRAY[1..3] OF LREAL;
END_VAR

Name

Type

Description

stRotation

ARRAY[1..3] OF LREAL

Presetting of MCS Rotation1, Rotation2 and Rotation3

FB_KinPresetRotation 6: 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).

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.7

Advanced Motion Pack V3.1.10.1

PC or CX (x86 or x64)

Tc2_KinematicTransformation (V3.2.7.3 or later)