Controlling the LED ring deck from Python

Discussions and questions about the Crazyflie Nano Quadcopter
cgpenguin
Member
Posts: 35
Joined: Wed Aug 05, 2020 3:49 pm

Re: Controlling the LED ring deck from Python

Post by cgpenguin »

kimberly wrote: Thu Oct 08, 2020 7:55 am Hi!

So you are trying to change the LED's in flight? Have you tried this example yet from this blogpost?

By the way, your code was not available anymore in the link that you posted. You can use gist?
I tried the example and I noticed a couple things:
  • Drone doesn't start flying right when I see entry Step x: Takeoff(...)/Goto(...)
  • When it starts flying (happens around step 7-10 I think), it goes hectic, falls on it's back and crashes
  • The LED color change also happens the very moment it starts flying
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Controlling the LED ring deck from Python

Post by kristoffer »

I tried your script, it works as expected.

I also verified that the examples/swarm/synchronizedSequence.py script works. If you are using one drone only, you have to remove two of the uris in the

Code: Select all

URI
list and remove all entries in the

Code: Select all

sequence
where the id is not 0.

Which positioning system are you using?
cgpenguin
Member
Posts: 35
Joined: Wed Aug 05, 2020 3:49 pm

Re: Controlling the LED ring deck from Python

Post by cgpenguin »

I am using Lighthouse (currently v1).

Thing is, the scripts actually work, but there's the issue of some things only starting to work after a certain time period (namely the LEDs and in the example you had linked before, the flying too (plus it crashed, but it might have been related to drone trying to get to the position instantly rather than the 1 or so second timeframe given in the script). And in those cases it appears that the drone is not doing any tasks and then suddenly it instantly tries to do all the tasks dumped on it (therefore the script I posted in previous post gets the lights suddenly flickering through a lot of colors before starting to update at each interval where new goto command is given).

I will also film the behavior later today to hopefully explain the issues better.
cgpenguin
Member
Posts: 35
Joined: Wed Aug 05, 2020 3:49 pm

Re: Controlling the LED ring deck from Python

Post by cgpenguin »

https://www.youtube.com/watch?v=Xa1A3ov ... e=youtu.be

Here's the video. It's running the code I posted before. As you can see, the ring only starts changing colors at around the 4th checkpoint where it bursts through a lot of colors before starting to behave as expected.
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Controlling the LED ring deck from Python

Post by kristoffer »

Thanks for the video, it makes it easier to understand what you see,
Your script works OK when I try it, so we know the script is fine.

The first thing to check is that all your firmware (both NRF and STM) are on the latest version and works together. The easiest way to flash them both is to use the (latest) python client and flash the 2020.09 release (see https://www.bitcraze.io/documentation/r ... re-upgrade). It is possible that you could get the problems you see if your NRF firmware is old.

Let us know if it makes any difference.
cgpenguin
Member
Posts: 35
Joined: Wed Aug 05, 2020 3:49 pm

Re: Controlling the LED ring deck from Python

Post by cgpenguin »

Hey!

I updated both stm and nrf through client (and then stm again with make cload to include the lighthouse driver) and now it appears to work just fine. Thank you!
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Controlling the LED ring deck from Python

Post by kristoffer »

Excellent!
Good luck with your future adventures!
FrancissJordan
Beginner
Posts: 1
Joined: Mon Oct 11, 2021 11:45 am

Re: Controlling the LED ring deck from Python

Post by FrancissJordan »

As I know, it's not so easy to write such a script. Anyway, if you are good with Python, you will succeed. One of my friends tried to write a script using Java, but this was a big fail and a waste of time. Anyway, also an important part is to have excellent LED strips. I got mine from led strip lights in the UK, and I am very delighted with it. I think these guys are making the best quality led lights in Europe because I tried different shops and only their product lasts one year. You should try to order from them.
Post Reply