How to change the LED color at the same time?

Discussions related to positioning systems where the position is calculated outside the Crazyflie and sent to the device using radio, including MoCap systems
Post Reply
minisol0175
Beginner
Posts: 4
Joined: Mon Jun 14, 2021 1:33 am

How to change the LED color at the same time?

Post 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??
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

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

Post 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!
minisol0175
Beginner
Posts: 4
Joined: Mon Jun 14, 2021 1:33 am

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

Post 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
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

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

Post 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
Post Reply