.. _get_current_rotm: get_current_rotm ------------------------------------------ This function returns the rotation matrix of the current tool orientation in the BASE coordinate system (eTargetRef = COORDINATE_SYSTEM_BASE, the default) or, with monitoring version 1, in the WORLD coordinate system. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp float (*get_current_rotm(COORDINATE_SYSTEM eTargetRef = COORDINATE_SYSTEM_BASE))[3] { return _get_current_rotm(_rbtCtrl, eTargetRef); }; **Parameter** .. list-table:: :widths: 20 20 20 40 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - eTargetRef - :ref:`COORDINATE_SYSTEM ` - COORDINATE_SYSTEM_BASE - Reference coordinate system for which the rotation matrix is calculated. Currently, only COORDINATE_SYSTEM_BASE and COORDINATE_SYSTEM_WORLD are supported, and COORDINATE_SYSTEM_WORLD requires setup_monitoring_version(1). To get the TCP orientation in another coordinate system, use get_current_posx(eTargetRef). **Return** .. list-table:: :widths: 25 75 :header-rows: 1 * - **Value** - **Description** * - float[3][3] - 3×3 Rotation matrix representing the tool’s current orientation relative to the coordinate system selected by eTargetRef. .. Caution:: The function does not refuse other eTargetRef values. With monitoring version 0 it ignores eTargetRef and returns the BASE matrix. With monitoring version 1 it returns the WORLD matrix for every value other than COORDINATE_SYSTEM_BASE. **Example** .. code-block:: cpp float (*result)[3] = drfl.get_current_rotm(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { printf("%f ", result[i][j]); } printf("\n"); } In this example, the **rotation matrix** of the tool is printed. Each element `result[i][j]` represents the orientation component of the tool flange with respect to the BASE coordinate system. This is especially useful for applications requiring **orientation control**, such as force alignment, compliance, or visual servoing.