ikin

This function receives a task-space pose (fSourcePos, [X, Y, Z, Rx, Ry, Rz]) in the coordinate system given by eTargetRef and returns the joint angles that reach it in the solution space selected by iSolutionSpace.

Definition
DRFLEx.h within class CDRFLEx, public section

LPROBOT_POSE ikin(
    float fSourcePos[NUM_TASK],
    unsigned char iSolutionSpace,
    COORDINATE_SYSTEM eTargetRef = COORDINATE_SYSTEM_BASE
) {
    return _ikin(_rbtCtrl, fSourcePos, iSolutionSpace, eTargetRef);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fSourcePos

float[6]

Target task pose [X, Y, Z, Rx, Ry, Rz] to solve for, in the coordinate system given by eTargetRef.

iSolutionSpace

unsigned char

Solution space index (0–7), or 255 to let the controller choose the reachable solution.
Indicates which inverse kinematics configuration to use (e.g., elbow up/down, wrist flip, etc.).

eTargetRef

COORDINATE_SYSTEM

COORDINATE_SYSTEM_BASE

Reference coordinate system of fSourcePos.

Return

Value

Description

ROBOT_POSE

Joint angles [deg] (J1–J6) in _fPosition that reach fSourcePos in the solution space selected by iSolutionSpace.

Note

This call waits for the controller to answer.

The call overwrites the data returned earlier by get_current_posx, get_desired_posx, fkin, the other ikin overloads, ikin_norm, trans, coord_transform, calc_coord, get_user_home, get_user_cart_coord and flange_serial_read. The pointer is never NULL; if the request cannot be sent, all joint angles are 0. Do not use a NULL check to detect failure.

Caution

The returned pointer refers to one ROBOT_POSE shared by all CDRFLEx objects in the process. The next call to this 3-argument ikin on any CDRFLEx object overwrites it. Copy the joint angles before calling it again, and do not call it on two CDRFLEx objects at the same time.

Example

float x1[6] = { 370.9, 719.7, 651.5, 90, -180, 0 };
LPROBOT_POSE res = drfl.ikin(x1, 2);

float q1[6] = { 0 };
for (int i = 0; i < 6; i++) {
    q1[i] = res->_fPosition[i];
}

drfl.movej(q1, 60, 30);

In this example, the function computes the inverse kinematics of the task pose x1 to get the joint angles for solution space 2, and the robot moves to them with movej. By selecting iSolutionSpace, the user controls which configuration (among multiple possible IK solutions) the robot uses.