set_robot_control

This is a function that the user can set and convert the current operation state in the robot controller.

Definition
DRFLEx.h within class CDRFLEx, public section (line 698)

bool set_robot_control(ROBOT_CONTROL eControl) { return _set_robot_control(_rbtCtrl, eControl); };

Parameter

Parameter Name

Data Type

Default Value

Description

eControl

ROBOT_CONTROL

Control command to apply to the robot controller.

Return

Value

Type

Description

0

int

Error — failed to change the control state.

1

int

Success — successfully changed the control state.

Example

if (drfl.get_robot_state() == ESTATE_SAFE_OFF) {
    // Servo ON (reset from SAFE OFF)
    drfl.set_robot_control(CONTROL_RESET_SAFET_OFF);
}
else if (drfl.get_robot_state() == ESTATE_SAFE_OFF2) {
    // Enter recovery mode
    drfl.set_robot_control(CONTROL_RECOVERY_SAFE_OFF);
}

This example checks the robot’s safe-off state and sends a control command accordingly. It resets the servo power or performs recovery, enabling the robot to return to a controllable state.