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.

set_state_led_off (Auto Mode)

This section explains how to use set_state_led_off during Auto operations. This function turns off the robot’s State LED completely. It is often used when you want to disable LED indication temporarily during maintenance or quiet operation.

Available in Auto mode only, on controller v3.4 or later. In other modes, or on an older controller, the function returns false. The mode check uses the value returned by get_robot_mode.

Typical usage

  • Turn off LED illumination during diagnostics.

  • Use when LED light may interfere with visual calibration or camera sensing.

  • Disable LED to indicate a “paused” or “standby” condition.

Example

The example obtains control authority and sets Auto mode before the LED calls, because the LED functions are refused in other modes.

#include <atomic>
#include <chrono>
#include <cstdio>
#include <thread>

std::atomic<bool> g_bHasControlAuthority(false);

void OnMonitoringAccessControlCB(const MONITORING_ACCESS_CONTROL eAccess)
{
    if (eAccess == MONITORING_ACCESS_CONTROL_GRANT)
        g_bHasControlAuthority = true;
}

drfl.set_on_monitoring_access_control(OnMonitoringAccessControlCB);
if (!drfl.open_connection("192.168.137.100")) return 1;
drfl.manage_access_control(MANAGE_ACCESS_CONTROL_FORCE_REQUEST);
while (!g_bHasControlAuthority)
    std::this_thread::sleep_for(std::chrono::milliseconds(100));

// The LED functions are refused unless Auto mode is set
if (!drfl.set_robot_mode(ROBOT_MODE_AUTONOMOUS)) return 1;

if (!drfl.set_state_led_off()) {
    printf("[ERROR] Failed to turn off the State LED.\n");
    return 1;
}
printf("[LED] State LED has been turned off.\n");

std::this_thread::sleep_for(std::chrono::seconds(3));
if (drfl.state_led_reset())  // Restore LED afterward
    printf("[LED] LED reset to default state.\n");
else
    printf("[ERROR] Failed to reset LED state.\n");

This function disables all LED output, allowing tasks to be performed without LED distraction or ambient light interference.

Note

A return of true does not confirm that the LED changed.

Tips

  • Use to indicate a standby or inactive state during pauses.

  • Combine with state_led_reset to restore LED behavior after maintenance.

  • Helpful when performing camera calibration or light-sensitive operations.