Page 1 of 1

How to change the LED color at the same time?

Posted: Mon Jun 14, 2021 9:41 am
by minisol0175
Hi everyone,

I'm trying to change the color of the LED rings at the same time.

I used crazyflie_ros and vicon.

When I try this code,

Code: Select all

cf1.setparam("ring/solidbule", 100)
cf1.setparam("ring/solidred", 100)
cf1.setparam("ring/solidgreen", 100)
cf1 meens crazyflie no.1.
I used 9 crazyflies and 3 radios.

When I do this, it has a time delay.

How can I change color at the same time??

Re: How to change the LED color at the same time?

Posted: Tue Jun 15, 2021 8:01 am
by kimberly
Hi!

I think the synchronizedSequence.py has a nice example of how to change the LED colors in one go. You will need to put the the mode of the LED ring into the right mode, which is either fade (14) (as in the example or solid color (7) I believe.

Let us know if you are able to manage to get it to work!

Re: How to change the LED color at the same time?

Posted: Wed Jun 16, 2021 4:41 am
by minisol0175
Thank you!

And I tried that.

result:
AttributeError: Crazyflie instance has no attribute 'param'

I think this is because I used crazyflie_ros.

So I deleted 'param' and tried again, like this
cf.set_value('ring.fadeTime', str(time))

result:
AttributeError: Crazyflie instance has no attribute 'set_value'


In rosparam list, I can find params about LED ring.

/crazyflie1/ring/effect
/crazyflie1/ring/emptyCharge
/crazyflie1/ring/fadeColor
/crazyflie1/ring/fadeTime
/crazyflie1/ring/fullCharge
/crazyflie1/ring/glowstep
/crazyflie1/ring/headlightEnable
/crazyflie1/ring/neffect
/crazyflie1/ring/solidBlue
/crazyflie1/ring/solidGreen
/crazyflie1/ring/solidRed

Re: How to change the LED color at the same time?

Posted: Wed Jun 16, 2021 5:37 am
by kristoffer
What you want to do is to set the parameter ring.fadeColor to the appropriate value. The example uses the cflib and not ROS as you noted and that is why you can not call the function.
I don't use ROS my self but you probably need to start by figuring out how to set parameters. When you know how to set parameters /crazyflie1/ring/fadeColor looks like what you want to change