change_operation_speed

This function adjusts the operation velocity. The argument is the relative velocity as a percentage of the currently set velocity and has a value from 1 to 100. Therefore, a value of 50 means that the velocity is reduced to 50% of the currently set velocity.

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 change_operation_speed(float fSpeed) {
    return _change_operation_speed(_rbtCtrl, fSpeed);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fSpeed

float

Operation speed (1–100%)
Represents the relative velocity ratio compared to the currently set value.

Return

Value

Type

Description

0

int

Failed

1

int

Success

Example

string strDrlProgram = "loop = 0\n"
                       "while loop < 3:\n"
                       "    movej(posj(10,10,10,10,10,10), vel=60, acc=60)\n"
                       "    loop = loop + 1\n";

if (drfl.get_robot_state() == STATE_STANDBY) {
    if (drfl.set_robot_mode(ROBOT_MODE_AUTONOMOUS) && drfl.get_robot_mode() == ROBOT_MODE_AUTONOMOUS) {
        // The operation speed can be changed only in Auto mode
        if (!drfl.change_operation_speed(40)) {
            printf("change_operation_speed failed\n");
        } else {
            ROBOT_SYSTEM eTargetSystem = ROBOT_SYSTEM_VIRTUAL;
            drfl.drl_start(eTargetSystem, strDrlProgram);
        }
    }
}

This example changes the robot’s operation speed to 40% of the current setting and then executes a simple DRL motion loop in Auto mode. The new speed value applies immediately to all subsequent motion commands executed by the controller.