For information on the latest version, please have a look at 1.33.5.
get_control_mode (Manual Mode)
This section explains how to use 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) andCONTROL_MODE_TORQUE(4). The controller can also report 0 (servo off), 1 (servo on) or 2 (hold), which have noCONTROL_MODEname, 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
// 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.