Skip to main content

Lighting Interfaces

LightControlClient controls the robot LEDs.

Source headers:

  • include/booster/robot/device/light/light_control_client.hpp
  • include/booster/robot/device/light/light_control_api.hpp

Interfaces​

Method

Description

Minimum firmware

SetLEDLightColor(r, g, b)

Set one RGB color.

>= v1.5.0.9

SetLEDLightColors(colors)

Set a list of colors.

>= v1.7.1.0

StopLEDLightControl()

Stop LED control.

>= v1.5.0.9

C++ Example​

#include <vector>

#include <booster/robot/channel/channel_factory.hpp>
#include <booster/robot/device/light/light_control_client.hpp>

booster::robot::ChannelFactory::Instance()->Init(0, "<network_ip>");

booster::robot::light::LightControlClient light;
light.Init();
light.SetLEDLightColor(255, 40, 20);

std::vector<booster::robot::light::SetLEDLightColorParameter> colors{
booster::robot::light::SetLEDLightColorParameter("#00ff80"),
booster::robot::light::SetLEDLightColorParameter(0, 40, 255),
};
light.SetLEDLightColors(colors);
light.StopLEDLightControl();

Enums and Parameters​

Public LightApiId values are kSetLEDLightColor = 2000 (set one RGB color), kStopLEDLightControl = 2001 (stop active lighting control), and kSetLEDLightColors = 2002 (set an ordered color list). SetLEDLightColorParameter contains RGB components r_, g_, and b_ in the range 0..255 and can also be constructed from a #RRGGBB string. SetLEDLightColorsParameter::colors_ stores colors in LED order. Both parameter classes provide FromJson and ToJson.