You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

get_robot_mode

Returns the mode stored in this CDRFLEx instance (initially ROBOT_MODE_MANUAL). set_robot_mode stores the requested mode. Calls that send a safety mode to the controller also store the mode when the controller accepts it: drl_stop stores Manual mode, set_safety_mode and the initialization and recovery options of set_robot_control store the safety mode they send, and multi_jog, motion and force-control commands store the current safety mode. The stored mode is not read from the controller; call set_robot_mode(ROBOT_MODE_AUTONOMOUS) before Auto-only functions, even if the controller is already in Auto mode. To confirm that the controller accepted a mode change, check the return value of set_robot_mode.

Auto mode automatically executes motions (programs) configured in sequential order, while Manual mode executes single motions such as jog.

Definition
DRFLEx.h within class CDRFLEx, public section

ROBOT_MODE get_robot_mode() { return _get_robot_mode(_rbtCtrl); };

Parameter
None

Return

Value

Description

ROBOT_MODE

Refer to the Definition of Enumeration Type

Caution

set_robot_mode stores the requested mode even when it returns false. get_robot_mode then returns the requested mode, and functions that require Auto or Manual mode accept calls although the controller did not change mode. If set_robot_mode returns false, do not use mode-gated functions until a later set_robot_mode call returns true.

Example

#include <thread>
#include <chrono>

string strDrProgram = "\r\n"
                      "loop = 0\r\n"
                      "while loop < 3:\r\n"
                      "    movej(posj(10,10,10,10,10,10), vel=60, acc=60)\r\n"
                      "    movel(posx(559, 434.5, 651.5, 0, 180, 0), vel=60, acc=60)\r\n"
                      "    loop=loop+1\r\n"
                      "movej(posj(10,10,10,10,10,10), vel=60, acc=60)\r\n";

if (drfl.get_robot_state() == STATE_STANDBY) {
    if (drfl.get_robot_mode() == ROBOT_MODE_MANUAL) {
        // Manual mode
        drfl.jog(JOG_AXIS_JOINT_3, MOVE_REFERENCE_BASE, 10.0f);  // start jog
        std::this_thread::sleep_for(std::chrono::seconds(2));
        drfl.jog(JOG_AXIS_JOINT_3, MOVE_REFERENCE_BASE, 0.0f);   // stop jog
    }
    else {
        // Automatic mode
        ROBOT_SYSTEM eTargetSystem = ROBOT_SYSTEM_VIRTUAL;
        drfl.drl_start(eTargetSystem, strDrProgram);
    }
}

This example checks the robot’s operation mode and performs different actions accordingly. In Manual mode, the robot executes a short jog motion; in Auto mode, it runs a predefined DRL program sequentially.