1 Interface Overview
The LED control interface is used to control the LED light effects on the robot, supporting various colors and LED effect modes (blinking, constant on, breathing, water flow, etc.). Developers switch LED modes by publishing the LedControl message, and the command takes effect immediately.
2 Message Fields and Mode Enum
Communication Interface:
| Topic Name | Message Type | Direction | Description |
|---|---|---|---|
/hardware/led_control | LedControl.msg | Client → Lighting Control Service | Send lighting control request |
The complete message definition can be found in the GitHub Message Directory.
Supported LED Modes:
| Mode Constant | Description | Effect |
|---|---|---|
0 | Restore | Restore built-in lighting |
BLINK_RED | Red blinking | LED red fast blinking |
BLINK_GREEN | Green blinking | LED green fast blinking |
BLINK_BLUE | Blue blinking | LED blue fast blinking |
BLINK_WHITE | White blinking | LED white fast blinking |
CONSTANT_ON_WHITE | White constant on | LED white continuously lit |
CONSTANT_ON_GREEN | Green constant on | LED green continuously lit |
BREATHE_WHITE | White breathing | LED white breathing effect |
WATER_WHITE | White water flow | LED white water flow effect |
BREATHE_RED | Red breathing | LED red breathing effect |
BLINK_ORANGE | Orange blinking | LED orange fast blinking |
CONSTANT_ON_ORANGE | Orange constant on | LED orange continuously lit |
3 Example: LED Mode Cycling
File Name: led_control_example.py
This example automatically switches the LED mode every 1 second, cycling through all available lighting effects.
Run Command:
Bash |
Custom LED Control:
Python |
4 Notes
- LED control commands take effect immediately
- It is recommended to control the publishing frequency to avoid overly frequent switching
- Some mode combinations may not be supported by the hardware
- If a built-in system error or warning occurs, the ROS2 lighting design interface will become invalid
📎 Source files in the open-source repository for this chapter (click file name to jump to GitHub): LedControl.msg · led_control_example.py
