From e3addb9eb06ebb084962dce975e89cd4b44dd1fe Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 5 Apr 2022 08:24:33 +0400 Subject: [PATCH] docs: add an example to get the configured number of LEDs --- docs/en/leds.md | 6 ++++++ docs/ru/leds.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/en/leds.md b/docs/en/leds.md index 7ee6fff6..d8606ec4 100644 --- a/docs/en/leds.md +++ b/docs/en/leds.md @@ -158,3 +158,9 @@ Current LED strip state is published in the `/led/state` ROS topic. You can view ```bash rostopic echo /led/state ``` + +Using the same topic you can get the configured number os LEDs, using Python: + +```python +led_count = len(rospy.wait_for_message('led/state', LEDStateArray, timeout=10).leds) +``` diff --git a/docs/ru/leds.md b/docs/ru/leds.md index 3223f512..5519c2cb 100644 --- a/docs/ru/leds.md +++ b/docs/ru/leds.md @@ -158,3 +158,9 @@ rosservice call /led/set_leds "leds: ```bash rostopic echo /led/state ``` + +Используя этот же топик можно получить общее выставленное в настройках количество светодиодов: + +```python +led_count = len(rospy.wait_for_message('led/state', LEDStateArray, timeout=10).leds) +```