.. _ikin_extension: ikin (extension) ------------------------------------------ This function returns the joint position, among the 8 joint configurations, that corresponds to iSolutionSpace and is equivalent to the robot pose in task space. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp LPINVERSE_KINEMATIC_RESPONSE ikin( float fSourcePos[NUM_TASK], unsigned char iSolutionSpace, COORDINATE_SYSTEM eTargetRef, unsigned char iRefPosOpt ) { return _ikin_ex(_rbtCtrl, fSourcePos, iSolutionSpace, eTargetRef, iRefPosOpt); }; **Parameter** .. list-table:: :widths: 18 18 18 46 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - fSourcePos - float[6] - - - Target task location for six axes (TCP pose to be solved for). * - iSolutionSpace - unsigned char - - - Solution space index (0-7) selecting one of eight IK configurations, or 255 to let the controller choose the reachable solution. * - eTargetRef - :ref:`COORDINATE_SYSTEM ` - - - Reference coordinate system for the TCP. * - iRefPosOpt - unsigned char - - - Reference pose option. The function does not send this value to the controller, so every value gives the same result. **Return** .. list-table:: :widths: 25 75 :header-rows: 1 * - **Value** - **Description** * - :ref:`LPINVERSE_KINEMATIC_RESPONSE ` - Extended inverse-kinematics response including the solved joint position (and related metadata). .. note:: This call waits for the controller to answer. The returned pointer refers to storage in the CDRFLEx object that other DRFL calls and every reconnect reuse; copy the structure before making another DRFL call. The 3-argument ``ikin`` returns its result in storage shared by all CDRFLEx objects in the process instead; see :ref:`ikin `. Except for ``get_user_home``, the pointer is never NULL; do not use a NULL check to detect failure. **Example** .. code-block:: cpp float x6[6] = { 370.9f, 719.7f, 651.5f, 90.f, -180.f, 0.f }; LPINVERSE_KINEMATIC_RESPONSE res = drfl.ikin(x6, 2, COORDINATE_SYSTEM_BASE, (unsigned char)0); float q[6] = {0}; for (int i = 0; i < 6; ++i) { q[i] = res->_fTargetPos[i]; // copy solved joints } drfl.movej(q, 60, 30); This example solves IK for the TCP pose `x6` in the **BASE** frame with **solution space = 2** and **ref-pose option = 0**. The solved joint values are copied from `res->_fTargetPos` into `q`, then executed via `movej(q, 60, 30)` (velocity 60, acceleration 30). Use different solution spaces (0-7) to select another valid joint configuration for the same TCP pose.