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.

drl_start

This function runs a program (task) written in DRL in the robot controller.

Available in Auto mode only. In other modes the function returns false and prints “this command can only be used in auto mode. please change to auto mode as robot mode”. The mode check uses the value returned by get_robot_mode.

Definition
DRFLEx.h within class CDRFLEx, public section

bool drl_start(ROBOT_SYSTEM eRobotSystem, string strDrlProgram) {
    return _drl_start(_rbtCtrl, eRobotSystem, strDrlProgram.c_str());
};

Parameter

Parameter Name

Data Type

Default Value

Description

eRobotSystem

ROBOT_SYSTEM

Refer to the Definition of Enumeration Type

strDrlProgram

string

Program character string to execute. The DRL program text must not exceed 1,042,433 bytes.

Return

Value

Type

Description

0

int

Error

1

int

Success

Note

Returns false without a message when the robot is in STATE_EMERGENCY_STOP, STATE_SAFE_OFF, STATE_SAFE_OFF2, STATE_SAFE_STOP or STATE_SAFE_STOP2.

Returns false if the request was refused. A return of true does not confirm that the controller applied the request; get_robot_mode and get_program_state report the request made by this CDRFLEx instance, so they do not confirm it either. A refusal is reported through TOnLogAlarmCB.

Example

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

if (drfl.get_robot_state() == STATE_STANDBY) {
    if (drfl.get_robot_mode() == ROBOT_MODE_AUTONOMOUS) {
        // Automatic Mode
        ROBOT_SYSTEM eTargetSystem = ROBOT_SYSTEM_VIRTUAL;
        drfl.drl_start(eTargetSystem, strDrlProgram);
    }
}

Note

  • The robot operation state should be STATE_STANDBY, and the robot moves normally when the robot is in Auto mode.

  • Write the DRL program according to the programming manual document in the appendix.

This function enables execution of DRL-language motion tasks directly on the controller. It is primarily used for autonomous or batch task execution, with DRL commands defined in string form. Ensure that the controller is in standby and Auto mode before invoking this function.