5.2.3 LED Strip Control
The chest LED strip control interface provides enhanced visual interaction capabilities.
Key Features
Independent RGB component control
Multiple display modes supported
LED Strip Control Service
Service Name |
Data Type |
Description |
|---|---|---|
|
|
LED Strip Control |
Attention
The LED strip service responds slowly; expect ~5 seconds for a full call. For multitasking, run this service in a separate thread or use asynchronous calls.
Caution
As standard ROS DO NOT handle cross-host service (request-response) well, please refer to SDK examples to use open interfaces in a robust way (with protection mechanisms e.g. exception safety and retransmission)
While the robot is in Stable Standing Mode or Locomotion Mode, DO NOT launch ROS nodes in rapid bulk (no more than 2 nodes per second is recommended), as a large number of nodes joining DDS discovery within a short period causes communication congestion and degrades motion control real-time performance, which may cause the robot to lose balance and fall
SetPmuLedros2-srv @ hal/srv/SetPmuLed.srv# LED Strip Control # Service: /aimdk_5Fmsgs/srv/SetPmuLed # Request CommonRequest request # Request header string trace_id # Source trace ID uint8 led_strip_mode # LED mode (0: steady, 1: breathing, 2: blinking, 3: flowing) uint8 r # Red component, 0–255 uint8 g # Green component, 0–255 uint8 b # Blue component, 0–255 int32 priority # Priority (higher value = higher priority, initial threshold is 0) bool reset_priority # When true, resets the threshold to 0 --- # Response ResponseHeader header # Response header uint16 status_code # Status code (0: success, 0x1024: insufficient priority, others: failure)
led_strip_modedescription:Value
Mode
Description
0
Steady
1
Breathing
4-second cycle, sinusoidal brightness transition
2
Blinking
1-second cycle, toggles every 0.5s
3
Flowing
2-second cycle, lights move left → right, then turn off simultaneously
≥4
Invalid
Unsupported mode value; the request will be rejected
Priority Mechanism
The system maintains a priority threshold (initially 0). A new request is accepted only when its
priorityis greater than or equal to the threshold, and the threshold is then updated to that value.When
priorityis lower than the threshold, the request is rejected and returnsstatus_code = 0x1024.reset_priority = truemeans forced preemption: skips the priority check, resets the threshold to 0, and executes the request (thepriorityfield is ignored and does not update the threshold). This is intended for urgent scenarios (e.g. whentask_managerneeds to forcibly take over the LED strip during faults or boot).
Attention
Avoiding LED strip control conflicts:
At runtime, the task_manager module automatically controls the LED strip during boot, state transitions, and fault diagnosis, which may override user settings. To retain persistent control of the LED strip, run the following command on the Motion Control Computing Unit (PC1) to stop the task_manager module:
aima em stop-app task_manager
If task_manager is not stopped, users can still call SetPmuLed, but note the following:
User LED strip settings may be forcibly preempted at any time by
task_manager’s automatic control (task_managerusesreset_priority=trueto skip the priority check and override directly).Subscribe to the
/aima/hal/pmu/led_statetopic to monitor LED strip state changes and re-apply settings after an override.
LED Strip State Topic
Topic Name |
Data Type |
Description |
QoS |
Frequency |
|---|---|---|---|---|
|
|
Current LED strip state |
|
1Hz |
PmuLedStateros2-msg @ hal/msg/PmuLedState.msg# PMU LED strip state MessageHeader header # Message header (not enabled; see note below) string trace_id # Source trace uint8 led_strip_mode # LED strip mode (0 (LED_STRIP_MODE_CONSTANT constant), 1 (LED_STRIP_MODE_BREATH breath), 2 (LED_STRIP_MODE_FLASH flash), 3 (LED_STRIP_MODE_FLOW flow)) uint8 r # Red component 0-255 uint8 g # Green component 0-255 uint8 b # Blue component 0-255 int32 priority # Currently effective priority
Note
led_state field usage notes:
header: The
MessageHeaderfield is currently not filled (stamp/frame_id/sequenceare all default zero values); do not use it for time synchronization.Semantics: This topic publishes the parameter values from the most recent
SetPmuLedrequest that passed the priority check, not the actual hardware state read back from the LED. Requests rejected due to insufficient priority (returns0x1024) do not update mode/r/g/b; requests whose SDK call fails still update the values.
Programming Examples
For detailed programming samples and explanations, refer to:
C++ Example: LED Strip Control
Python Example: LED Strip Control