.. _manual_get_control_mode: get_control_mode (Manual Mode) ------------------------------------------ This section explains how to use :ref:`get_control_mode ` during **Manual (Teach)** operations. Although defined in **3.1 Common**, this function is critical for verifying the **current control mode** of the robot before or during manual teaching. **Typical usage** - Confirm whether the robot is under **position** or **torque** control. - Prevent accidental motion commands in the wrong control mode. - Used before jogging, force teaching, or switching between operation modes. .. Note:: - The named modes are ``CONTROL_MODE_POSITION`` (3) and ``CONTROL_MODE_TORQUE`` (4). The controller can also report 0 (servo off), 1 (servo on) or 2 (hold), which have no ``CONTROL_MODE`` name, and the function returns 0 before the first monitoring data arrives. - In manual teaching, it should usually report **CONTROL_MODE_POSITION**. **Example: Checking Control Mode before Jogging** .. code-block:: cpp // Check current control mode before teaching CONTROL_MODE ctrl = drfl.get_control_mode(); printf("Current Control Mode: %d\n", ctrl); if (ctrl == CONTROL_MODE_POSITION) { printf("Safe to jog in position control.\n"); drfl.jog(JOG_AXIS_TASK_X, MOVE_REFERENCE_BASE, 10.0f); } else { printf("Jogging disabled: not in position control mode.\n"); } **Tips** - Always check the control mode before enabling jog or external force teaching. - If the mode is not ``CONTROL_MODE_POSITION``, switch modes through the pendant or API command. - Helps prevent unexpected motion when switching between auto and manual control.