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.

state_led_reset (Auto Mode)

This section explains how to use state_led_reset during Auto operations. This function resets the State LED to its default controller-defined rule. It is typically used when the LED color has been customized (via set_state_led_color) and needs to return to standard behavior reflecting system state.

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

  • Revert LED behavior after custom feedback (e.g., after color change).

  • Restore LED control to the robot controller’s internal rule logic.

  • Use at the end of a custom LED indication.

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.state_led_reset())
    printf("[LED] LED state reset to default controller rule.\n");
else
    printf("[ERROR] Failed to reset LED state.\n");

When called, this function restores the LED to its controller-managed mode, removing any color overrides applied with set_state_led_color.

Note

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

Tips