.. _servol_rt: servol_rt ------------------------------------------ This function performs **real-time task-space (TCP) position control** from an external controller. It commands the robot’s tool center point (TCP) position and orientation at each real-time control cycle, based on the target pose, velocity, acceleration, and interpolation time. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp bool servol_rt(float fTargetPos[NUM_TASK], float fTargetVel[NUM_TASK], float fTargetAcc[NUM_TASK], float fTargetTime) { return _servol_rt(_rbtCtrlUDP, fTargetPos, fTargetVel, fTargetAcc, fTargetTime); }; **Caution** - Communication latency or network jitter produces jerky ``servol_rt`` motion. - It is recommended to **tune the target time (fTargetTime)** and use a **slow response speed**, or alternatively use :ref:`speedl_rt ` for smoother motion. - ``fTargetTime`` is not the send interval. See the second **Caution** section below for how to choose it. **Parameter** .. list-table:: :widths: 25 20 20 35 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - fTargetPos - float[6] - - - Target pose [X, Y, Z, A, B, C] in mm and deg; the orientation uses the Euler ZYZ convention. * - fTargetVel - float[6] - - - Target TCP velocity [mm/s, deg/s] |br| If set to **-10000**, velocity is automatically calculated from ``fTargetPos`` * - fTargetAcc - float[6] - - - Target TCP acceleration [mm/s², deg/s²] |br| If set to **-10000**, acceleration is automatically computed * - fTargetTime - float - - - Target interpolation duration [s] **Note** - **Asynchronous command.** - The internal motion profile interpolates between current and target states |br| *(fTargetPos, fTargetVel, fTargetAcc)* over ``fTargetTime``. - On releases with the 0.001 s minimum, if ``fTargetTime`` ≤ controller’s cycle (~1 ms), interpolation is skipped. - If the next command is not received before completion, the robot decelerates to a stop with the task acceleration set by :ref:`set_accx_rt `. **Caution** - The current implementation is **not linked** with Operation Speed [%]. - ``fTargetTime`` is the time the controller is given to reach the target, and it is **not** the interval at which commands are sent. Set it comfortably larger than the send interval so consecutive commands overlap. - The controller enforces a **minimum** ``fTargetTime`` and raises smaller values to it. Minimum fTargetTime: 0.001 s on DRCF v2.12.x and v3.3.x. On DRCF v3.4.0 or later, values below 0.025 s are raised to 0.025 s, and each command then takes fTargetTime + 0.005 s. A value below the minimum is silently replaced, so a value tuned on one controller release must be re-checked on another. - The send interval must match the period declared to :ref:`set_rt_control_input `, or the input watchdog ends the session while ``servol_rt`` keeps returning 1. - For continuous position control, consider :ref:`speedl_rt `. - Not compatible with **force/compliance control** or **DR_VAR_VEL** near singularities; |br| the system automatically reverts to **DR_AVOID** mode in such cases. **Return** .. list-table:: :widths: 20 80 :header-rows: 1 * - **Value** - **Description** * - 1 - The command was sent. This does not confirm that the controller received or applied it. * - 0 - The command datagram could not be sent. .. note:: This function is asynchronous. It returns without waiting for the controller to accept or reject the command, so a return value of 1 does not confirm that the robot acted on it. Rejected commands and motion warnings and errors are reported through :ref:`set_on_log_alarm `. :ref:`set_on_rt_log_alarm ` reports only RT session messages, so register both callbacks. **Example** .. code-block:: cpp drfl.connect_rt_control("192.168.137.100", 12347); std::string version = "v1.0"; float period = 0.001f; // 1 ms int lossCount = 4; // Configure real-time streaming drfl.set_rt_control_input(version, period, lossCount); drfl.set_rt_control_output(version, period, lossCount); drfl.start_rt_control(); // Define target TCP pose float fTargetPos[6] = {150.f, 0.f, 100.f, 0.f, 0.f, 0.f}; float fTargetVel[6] = {200.f, 100.f, 100.f, 20.f, 20.f, 20.f}; float fTargetAcc[6] = {1000.f, 800.f, 800.f, 100.f, 100.f, 100.f}; float fTargetTime = 0.06f; // 60 ms (recommended >= 30 ms) // Send real-time task-space motion command if (drfl.servol_rt(fTargetPos, fTargetVel, fTargetAcc, fTargetTime)) printf("Task-space motion command successful.\n"); else printf("Task-space motion failed.\n"); drfl.stop_rt_control(); drfl.disconnect_rt_control(); This example shows how to control TCP motion in real time by sending continuous task-space commands at 1 ms intervals. **Tips** - Use ``servol_rt`` for **precise Cartesian interpolation control** in external systems. - Always ensure consistent timing between cycles for smooth motion. - For joint-level streaming, refer to :ref:`servoj_rt `.