Using python3, with the latest RVR python SDK (August 20 release), I am unable to change the color of rear LED on the RVR. The problem is I don’t know the attribute of the RvrLedGroups class that references the RVR’s rear LED.
In looking through the examples, I couldn’t find any python code that specifically changes the color of the rear LED. I also couldn’t find any end-user documentation concerning python control of the RVR LEDs. I was finally able to find LED -pecific attributes in rvr_led_groups_enum.py (located in the /sphero_sdk/common/enums directory).
Specifically here is what I found. As an aside, I know that some of the other LED-specific attributes in this program work. For example, I was able to use the “battery_door_front” and the “power_button_front” attributes to control the LEDs on the left-side and right-side of the RVR.
brakelight_left = SpheroRvrLedBitmasks.left_brakelight_red | \ SpheroRvrLedBitmasks.left_brakelight_green | \ SpheroRvrLedBitmasks.left_brakelight_blue brakelight_right = SpheroRvrLedBitmasks.right_brakelight_red | \ SpheroRvrLedBitmasks.right_brakelight_green | \ SpheroRvrLedBitmasks.right_brakelight_blue
Here is a portion of the code I ran to write to the rear LED:
from sphero_sdk import SpheroRvrObserver
from sphero_sdk import RawMotorModesEnum
from sphero_sdk import RvrLedGroups
from sphero_sdk import Colors
rvr.led_control.set_led_rgb(RvrLedGroups.breaklight_left, red=255, green=255, blue=0)**
Here is the error message I received:
Traceback (most recent call last):
__File “LED_test_program.py”, line 168, in
____rvr.led_control.set_led_rgb(RvrLedGroups.breaklight_left, red=255, green=255, blue=0)
__File “/usr/lib/python3.7/enum.py”, line 349, in getattr
____raise AttributeError(name) from None
Given this, here are my questions:
- Where can I find python-specific documentation on how to program the RVR LEDs?
- What is the python code for controlling the rear LED of the RVR?
Thanks in advance for any assistance you can provide.