LEDs API#
Overview#
ARI has 4 LED displaying devices capable of being controlled via our ROS interface:
- Back ring: a LED ring at the back, below the emergency button, with a
variety of colour options.
- Ears rings: LED ring in each of its ears with a variety of colour
options.
ReSpeaker: LED ring at the speaker.
ID |
#LEDs |
Available Effects |
|
---|---|---|---|
Back |
0 |
40 |
All |
Ear Left |
1 |
16 |
All |
Ear Right |
2 |
16 |
All |
ReSpeaker |
4 |
12 |
Fixed Color |
Different devices may have different capabilities, and may only be able to show part of the effects.
Documentation not yet available.
LED Manager API#
All LED devices are controlled using the same ROS Interface, provided by the PAL LED Manager. This interface allows clients to send effects to one or multiple LED devices, for a duration of time and a priority. When a device has more than one effect active at a time, it displays the one with the highest priority, until the duration ends and then displays the next effect with the highest priority. Thereโs a default effect with unlimited duration and lowest priority that displays a fixed color.
Interface#
The LED interface is an Action Server: /pal_led_manager/do_effect
A goal consists of:
devices A list of devices the goal applies to.
params The effect type, and the parameters for the selected effect type.
- effectDuration Duration of the effect, when the time is over the previous
effect will be restored. 0 will make it display forever
priority Priority of the effect, 0 is no priority, 255 is max priority
List of LED effects#
Effects |
ID |
---|---|
Set colour |
0 |
Rainbow |
1 |
Fade |
2 |
Blink |
3 |
Progress |
4 |
Flow |
5 |
Pre-programmed effect |
6 |
The different effects and parameters are listed in the pal_device_msgs/msg
Controlling LEDs through services#
The base of TIAGo is provided with a LED strip on both sides. LED strips are composed of pixel LEDs. TIAGo is provided with an application that changes the LED strips according to the robotโs speed. In order to perform any operation with the LED strips, this application need to be stopped. It can be done using the following command-line tool.
pal@tiago-0c:~$ pal module stop pal_led_manager
result: pal_led_manager stopped successfully
There are different services that allow to control the LED strips in TIAGo.
Note
The services provided for controlling the LEDs are launched by default on startup.
Note
Resulting color may be different or not visible at all due to the plastic that covers the LED strips.
/mm11/led/set_strip_color Sets all the pixels in the strip to a color.
The expected message is of type mm11_msgs/srv/SetStripColor
that consists of the
following arguments:
port, specifying which strip will be affected by the command, a port of value 0 referes to the left strip and 1 to the right strip
r, g and b referring to the color to be set in RGB scale
An example of how to call this service is shown in the following.
pal@tiago-0c:~$ ros2 service call /mm11/led/set_strip_color mm11_msgs/srv/SetStripColor \
"{port: 0, \
r: 255, \
g: 255, \
b: 0}"
/mm11/led/set_strip_pixel_color Sets one pixel in the strip to a color.
The service accepts messages of type mm11_msgs/srv/SetStripPixelColor
that consists of the
following arguments:
port specifying which strip will be affected by the command, a port of value 0 referes to the left strip and 1 to the right strip
pixel representing the position of the LED in the strip
r, g and b referring to the color to be set in RGB scale
An example of how to call this service is shown in the following.
pal@tiago-0c:~$ ros2 service call /mm11/led/set_strip_pixel_color mm11_msgs/srv/SetStripPixelColor \
"{ port: 0, \
pixel: 5, \
r: 255, \
g: 0, \
b: 0}"
/mm11/led/set_strip_flash Sets a flashing effect to the LED strip.
The service accepts messages of type mm11_msgs/srv/SetStripFlash
composed of the
following arguments:
port specifying which strip will be affected by the command, a port of value 0 referes to the left strip and 1 to the right strip
time representing the duration of the flash in milliseconds
period representing the time between flashes in milliseconds
r_1, g_1 and b_1 referring to the color of the flash in RGB scale
r_2, g_2 and b_2 referring to the background color of the flash in RGB scale
An example of how to call this service is shown in the following.
pal@tiago-0c:~$ ros2 service call /mm11/led/set_strip_flash mm11_msgs/srv/SetStripFlash \
"{ port: 0, \
time: 100, \
period: 1000, \
r_1: 255, \
g_1: 0, \
b_1: 0, \
r_2: 0, \
g_2: 0, \
b_2: 255}"
/mm11/led/set_strip_animation Sets an animation effect to the LED strip.
The service accepts messages of type mm11_msgs/srv/SetStripAnimation
requiring the following
arguments:
port specifying which strip will be affected by the command, a port of value 0 referes to the left strip and 1 to the right strip
- animation_id setting the type of animation
1
for pixels running left2
for pixels running right3
for pixels running back and forth, starting from the left4
for pixels running back and forth, starting from the right
param_1 representing the time between effects in milliseconds
param_2 representing the distance between animated pixels
r_1, g_1 and b_1 referring to the color of the animation in RGB scale
r_2, g_2 and b_2 referring to the background color of the animation in RGB scale
An example of how to call this service is shown in the following.
pal@tiago-0c:~$ ros2 service call /mm11/led/set_strip_animation mm11_msgs/srv/SetStripAnimation \
"{ port: 0, \
animation_id: 1, \
param_1: 100, \
param_2: 5, \
r_1: 255, \
g_1: 0, \
b_1: 0, \
r_2: 0, \
g_2: 0, \
b_2: 255}"
See also#
ari-leds
expressions_and_leds