How to switch dynamixel Led on using pypot?

Hi all!
I am currently working on Poppy Torso and I would like to switch the LED of a dynamixel on by using pypot. I have tried directly with the “pydynamixel” package, but the port of the motors is already used by pypot thus it doesn’t work very well.

I have found a topic about Dynamixel 320 led management using Pypot, but I didn’t find the same topic for the dynamixels of a Poppy torso.

Does anyone know how to do it ?

Best regards,
Jérôme

Hi @Jerome-Guichard,

I don’t know if there is a function in pypot to manage led on Dynamixel MX28, but the leds on XL30 are very differents:

With led of MX28 you can only turn on and off a led (red color), in contrary led of xl320 have 7 possibilities (red, blue, pink …)

Hi @tibo,

Thanks for your prompt reply.
You 're right, Led of Torsos’s servos can only light up in red, but that’s fine for me! :slight_smile:

Anyway, I am still investigating on a way to turn this red led on…

You can access to status led on pypot only by low level with switch_led_on and switch_led_off methods.

from pypot.dynamixel import DxlIO
dxl = DxlIO('/dev/ttyACM0')
# Switch on led of motor with id 13
dxl.switch_led_on({13})

# Switch on led of every detected motors with id < 60
motors = dxl.scan(range(60))
dxl.switch_led_on({id for id in motors})

Hello,

I try your code, but I have a issue :
DxlError: port already used /dev/ttyACM0.

Because I want to do this in a primitive of my robot, but the port is already used by my robot…
Some clues ?

Thomas

Yes, you cannot access multiple time at the same serial port. The code snippet above can only be done from the io level, not from the robot level ; you can access to the io level from the robot but it’s hided.

However, the led_status can be added to the motor level. Feel free to make a pull request to add this functionality.

Ok thanks.

I don’t have time now, but I will do that later.

Could you also do something for XL320 and to allow a color selection? (keywords, hexadecimal, or something else)

It’s already the case.

What are the possible values for set_LED_color?