state_led_reset
This function resets the robot’s state LED to its default configuration and color. It clears any previously set LED state or user-defined color and restores the LED behavior defined by the default controller settings.
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.
Definition
DRFLEx.h within class CDRFLEx, public section
bool state_led_reset()
{
return _state_led_reset(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
0 |
Fail — LED reset request failed |
1 |
Success — LED successfully reset to default state |
Note
A return of true does not confirm that the LED changed.
Example
// Assumes control authority is held; the LED functions work only in Auto mode
if (!Drfl.set_robot_mode(ROBOT_MODE_AUTONOMOUS)) {
printf("set_robot_mode failed.\n");
return 1;
}
// Indicate that the robot is in "operation" mode by setting LED to green
if (Drfl.set_state_led_color(0, 1, 0)) // Green color
printf("LED set to green: robot in operation mode.\n");
// Simulate task execution (e.g., motion or pick & place)
std::this_thread::sleep_for(std::chrono::seconds(3));
// Indicate task completion by setting LED to blue
if (Drfl.set_state_led_color(0, 0, 1)) // Blue color
printf("LED set to blue: task complete.\n");
// After finishing all operations, reset LED to default system color
if (Drfl.state_led_reset())
printf("LED reset to default system color.\n");
This example simulates LED usage for visual task indication. The LED is set to green during operation, changed to blue upon completion, and finally reset to its default color configuration using state_led_reset().