set_user_cart_coord2 (3-point method)

This function defines a new user Cartesian coordinate system using three input poses (fTargetPos[0], fTargetPos[1], and fTargetPos[2]) and an origin position (fTargetOrg) relative to the reference coordinate system (fTargetRef).

The three input poses specify the orientation and alignment of the new coordinate axes:
- The X-axis is determined by the vector from pose₁ → pose₂.
- The Z-axis is calculated as the cross product of the vectors (pose₂ − pose₁) × (pose₃ − pose₁).
- The Y-axis is computed as the cross product of Z × X.

Up to 20 user coordinate systems can be created. User coordinate IDs are 101 to 200. 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 fTargetPos[3][NUM_TASK],
    float fTargetOrg[3],
    COORDINATE_SYSTEM fTargetRef = COORDINATE_SYSTEM_BASE
) {
    return _set_user_cart_coord2(_rbtCtrl, fTargetPos, fTargetOrg, fTargetRef);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fTargetPos

float[3][6]

Three target task positions defining the plane of the new user coordinate
- Pose #1: reference start point
- Pose #2: defines X-axis direction
- Pose #3: defines the plane for Z-axis orientation

fTargetOrg

float[3]

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

fTargetRef

COORDINATE_SYSTEM

COORDINATE_SYSTEM_BASE

Reference coordinate system from which the new coordinate 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 three poses to establish the coordinate plane
float xs[3][6] = {
    {0.0f, 200.0f, 700.0f, 0.0f, 0.0f, 0.0f},
    {0.0f, 700.0f, 0.0f, 0.0f, 0.0f, 0.0f},
    {0.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f}
};

// Set the origin position
float org[3] = {10.0f, 30.0f, 15.0f};

// Register a new user coordinate system based on the three poses
int coord_id = drfl.set_user_cart_coord(xs, org, COORDINATE_SYSTEM_BASE);

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

This example defines a user Cartesian coordinate frame using three task-space poses and an origin offset, then registers it relative to the base coordinate system.