.. _set_ref_coord: set_ref_coord ------------------------------------------ This function sets the **reference coordinate system** of the controller. API motion and jog functions use their own ``eMoveReference`` argument, which set_ref_coord does not change (motion functions default to ``MOVE_REFERENCE_BASE``; jog and multi_jog require it); pass the user coordinate ID there to move relative to that coordinate system. If not explicitly changed, the reference coordinate defaults to the **base coordinate system**. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp bool set_ref_coord(COORDINATE_SYSTEM eTargetCoordSystem) { return _set_ref_coord(_rbtCtrl, eTargetCoordSystem); }; **Parameter** .. list-table:: :widths: 20 20 20 40 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - eTargetCoordSystem - :ref:`COORDINATE_SYSTEM ` - - - The reference coordinate system to set. |br| - `COORDINATE_SYSTEM_BASE` : Robot base frame |br| - `COORDINATE_SYSTEM_TOOL` : Current tool frame |br| - `COORDINATE_SYSTEM_WORLD` : World frame |br| - 101 to 200 : User coordinate ID **Return** .. list-table:: :widths: 25 75 :header-rows: 1 * - **Value** - **Description** * - 0 - Failed to set the reference coordinate system * - 1 - Successfully set the reference coordinate system **Example** .. code-block:: cpp // Move to a joint position float p1[6] = {0.f, 0.f, 90.f, 0.f, 90.f, 0.f}; drfl.movej(p1, 60, 30); // Create a custom user coordinate system float vec[2][3] = {{-1.f, 1.f, 1.f}, {1.f, 1.f, 0.f}}; float org[3] = {370.9f, -419.7f, 651.5f}; int user_id = drfl.set_user_cart_coord(vec, org); // Change reference coordinate to the user frame if (user_id >= 101 && user_id <= 200) { drfl.set_ref_coord((COORDINATE_SYSTEM)user_id); } This example defines a user coordinate system and sets it as the controller reference coordinate system. To move relative to it, pass the ID as eMoveReference to movel.