We have been flying swarms in our office plenty of times. There is kind of a limitation to this though, our flying space is only around 4 x 4 meters. Flying 8 – 10 Crazyflies in this space is challenging and it is hard do make it look good. Slight position inaccuracy makes it look a bit sloppy. To mitigate this we decided to have a small swarm show using a a bigger flying space and to invite families and friends, just to raise the stake a bit.
As usual we had limited time to accomplish this, and this time the result should be worth looking at. Well, we have managed to pull off hard things in one day before so why not this time… The setup is basically a swarm bundle with added LED-rings. Kristoffer took care of the choreography, Tobias setting up the drones and Arnaud configuring the Loco positioning system.
Kristoffers pre-Bitcraze history involves some dancing and he has been playing a bit earlier with the idea of creating choreographies with Crazyflies. One part of this was a weekend-hack a few months back when he tried to write a swarm sequencer that is a bit more dance oriented. The goal was to be able to run a sequence synchronized to music and define the movements in terms of bars and beats rather than seconds. He also wanted to be able to define a motion to end at a specific position at a beat as opposed to start on the beat. As Kristoffer did not have access to a swarm when he wrote the code he also added a simple simulator to visualize the swarm. The hack was not a complete success at that time but turned out to be useful in this case.
The sequences are defined in a YML file as a list of time stamps, positions and, if needed the color of the LED-ring. After a few hours of work he had at least some sort of choreography with 9 Crazyflies moving around, maybe not a master piece from a dance point of view but time was running out.
The simulator is super basic but turned out to be very useful anyway (the color of the crosses indicates the color of the LED ring). We actually never flew the full sequence with all drones before the performance, but trusted the simulation to be accurate enough! We did fly most of the sequence with one Crazyflie, to at least make it plausible that we got it all right.
Setting up drones
Handling swarms can be tedious and time consuming. Just making sure all drones are assembled, fully operational and charged is a challenge when the number increases. Tobias decided to do manual flight test of every drone. If it flies well manually it will most likely fly well autonomously. The testing resulted in switching out some motors and props as vibrations is a crippling factor, especially for Z accuracy. Takeaway from this exercise is to implement better self testing so this can be detected automatically and fixed much quicker.
Loco Positioning System
We ran the positioning system with standard firmware in TDoA mode to support multiple Crazyflies simultaneously. The mapped space was around 7 x 5 x 2.5 meters and the anchors were placed more or less in the corners of the flying space box.
The audience (families and friends) was enthusiastic and expectations high! Even though not all drones made it all the way through the show, the spectators seemed to be duly impressed and requested a re-run.
7 comments on “Playing with a swarm show”
How are you sending flight paths to the swarms? I am confused in how to go about sending direction to fly drones autonomously.
The full trajectories are stored in the computer and sent piece by piece to the drones via radio.
We send set points to tell each Crazyflie the position where it is supposed to be/go. The drones compare their current location with the set point and adjust to correct any errors.
In this case we also sometimes send velocity set points that tell the drones the speed and direction to move in to get better control of the motion. When the drone reaches the destination we switch back to an absolute position set point to make sure it ends up in the correct position.
An example of some python code that does something similar can be found in https://github.com/bitcraze/crazyflie-lib-python/blob/master/examples/swarmSequence.py
hi just wondering how did you guys manage to solve the collision problem? Did you solve it manually when designing the trajectories carefully or it can avoid collision automaticly by designing your python code？
It was done manually when designing the trajectories
hello! just wondering if the simulator shown in this blog post is available on y’alls github or anywhere else?
No, unfortunately not. The code was pretty messy and would probably not be very useful. I used matplotlib (https://matplotlib.org/) but it is not very good at this type of visualizations. Today I would probably use vispy (http://vispy.org/) instead.
Thank you for the quick response and the recommendation! I will go ahead and make a simulator with vispy