set_auto_servo_off
This function enables or disables the automatic servo-off transition feature in the robot controller. When enabled, the controller will automatically turn off the servo power if the robot remains idle for a specified duration.
This feature is useful for improving safety and energy efficiency, especially when the robot is not in continuous operation.
Definition
DRFLEx.h within class CDRFLEx, public section (line 914)
bool set_auto_servo_off(bool bFuncEnable, float fElapseTime) {
return _set_auto_servo_off(_rbtCtrl, bFuncEnable, fElapseTime);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
bFuncEnable |
bool |
Enables or disables the auto servo-off feature |
|
fElapseTime |
float |
Duration (in minutes) of inactivity before servo power is turned off. |
Return
Value |
Description |
|---|---|
0 |
Error — failed to configure the auto servo-off setting |
1 |
Success — setting successfully applied |
Example
#include "DRFLEx.h"
#include <iostream>
using namespace DRAFramework;
int main() {
CDRFLEx Drfl;
// Enable the auto servo-off function after 3 minutes of inactivity
if (Drfl.set_auto_servo_off(true, 3.0f))
std::cout << "Auto servo-off enabled (timeout: 3 minutes)\n";
else
std::cerr << "Failed to set auto servo-off behavior.\n";
// Later, disable the function to keep servo always active
Drfl.set_auto_servo_off(false, 0.0f);
return 0;
}
This example enables the auto servo-off function, causing the robot’s servo power to shut down automatically after 3 minutes of inactivity. The feature can later be disabled by calling the function again with bFuncEnable = false.