You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

set_user_cart_coord3 (vector method)

This function defines a new user Cartesian coordinate system using two input direction vectors (fTargetVec[0], fTargetVec[1]) and an origin position (fTargetOrg) relative to a reference coordinate system (fTargetRef).

  • fTargetVec[0] defines the X-axis direction vector.

  • fTargetVec[1] defines the Y-axis reference vector.

The Z-axis is automatically computed as the cross product of X × Y, ensuring orthogonality. If the provided vectors are not perfectly orthogonal, the system internally normalizes them to construct a valid right-handed coordinate frame.

This function is available in M2.5 hotfix version or higher and allows up to 20 user coordinate systems. Coordinate systems set with this function remain in the controller after the client program disconnects. For long-term use, register them in the Workcell configuration.

Definition
DRFLEx.h within class CDRFLEx, public section

int set_user_cart_coord(
    float fTargetVec[2][3],
    float fTargetOrg[3],
    COORDINATE_SYSTEM fTargetRef = COORDINATE_SYSTEM_BASE
) {
    return _set_user_cart_coord3(_rbtCtrl, fTargetVec, fTargetOrg, fTargetRef);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fTargetVec

float[2][3]

Two 3D vectors defining the coordinate orientation
- Vector 1 → X-axis direction
- Vector 2 → Y-axis reference direction

fTargetOrg

float[3]

Origin position (X, Y, Z) of the user coordinate system.

fTargetRef

COORDINATE_SYSTEM

COORDINATE_SYSTEM_BASE

Reference coordinate system from which the new coordinate frame is defined.

Return

Value

Description

int

ID of the successfully created coordinate system (101–200).
Returns 0 if the request cannot be sent.

Example

// Define X and Y direction vectors for the new coordinate frame
float vec[2][3] = {
    {1.0f, 1.0f, 1.0f},   // X-axis vector
    {1.0f, 0.0f, 0.0f}    // Y-axis reference vector
};

// Define the origin position
float org[3] = {370.0f, -45.0f, 521.5f};

// Create a new user coordinate system using vector method
int coord_id = drfl.set_user_cart_coord(vec, org, COORDINATE_SYSTEM_BASE);

printf("User coordinate (vector method) created with ID: %d\n", coord_id);

This example defines a new user Cartesian coordinate frame using two direction vectors and an origin position, then registers it relative to the base coordinate system.