This page describes the first online live Bitcraze tutorial session were we have explained the lighthouse spiraling swarm demo we have been showing and multiple conferences in the last few years. Here we will mostly focus on the lighthouse positioning system, high level commander and the App layer.
Here you will find the information about the tutorial itself.
Date: 4th of November 2020
Start time: 18:00 CET (Malmö Sweden)
Place: Online on Discord and Mozilla hubs
Schedule:
For the tutorial we will assume that you already know the Crazyflie® and have done some development for it in some way, so the introduction to our ecosystem will be very brief.
There are two main parts of the tutorial:
During the break and after the tutorial we can answer questions that are still remaining. We would prefer if they could be limited to the topics that we cover in the tutorial to also give us Bitcrazers some time to socialize with you guys in either mozilla hubs or discord :) That is something that we also really miss from not going to conferences so we are looking forward to meeting you all!
After the event, we will post the slides we used here and a link to the recordings of the tutorial.
What are the main differences bitween the Loco positioning and the Lighthouse?
You said V2 doesn’t use all the calibration values (yet). Does it mean you can get a better accuracy with V1 for the moment?
How much space can we cover compared to V1?
Could you please provide some links for v1 calibration
What is the functional range of lighthouse ?
Are the settings from the app persistent?
Can you estimate how many crazyfly can be used with one radio?
HL commander doesnt need position data from the computer? once it does its thing?
So it checks position in a few intervals instead of constantly?
So it needs less control data.. but does get position?
Is it possible to run this code without wireless charger?
Have you tried continuously running this demo in a loop in order to find how long it could be repeated automatically?
In HL commander there would maybe be room for a crash-preventer?
This section describes the demo we are running at tutorial with links to required source code to reproduce it.
We wanted to create a demo that is as fully automated as possible. We have 8 Crazyflie 2.1 with Lighthouse and Qi charger decks, each with a charging pad. A computer will orchestrate the Crazyflies and make sure one is flying at all times while the others re-charge their batteries on their pads. After a pre-programmed trajectory is finished or when the battery of the flying Crazyflie is depleted it goes back to its pad while another one takes over.
We use a computer for orchestration (we call it the Control tower) that controls when the Crazyflies take off. The communication between the computer and the Crazyflies is handled by a Crazyradio. When a Crazyflie has started, it runs its trajectory a fixed number of times or until it is low on battery. Basic state data is continuously transmitted from the quadrotors to the Control tower.
The Crazyflies are fairly automated and are mainly controlled by simple commands from the control tower. The demo app implements a state machine where most state transitions are automatic, while a few require input from the control tower.
When a Crazyflie is booted, it performs the normal initialization tests and waits for the positioning system to find its position. When it has position lock it is ready for action.
When it is time to fly, the control tower asks a Crazyflie to take off. At this point the Crazyflie records its current position (for landing purposes), takes off and hovers above the charging pad. It is now ready to fly.
The Control tower sends a start signal to the Crazyflie which then goes to the first coordinate of the pre-programmed trajectory. When at the starting point it runs the pre-programmed trajectory, a set number of times.
When the trajectory has been repeated the set number of times, the battery is low, or if the Control tower sends a landing command, the Crazyflie finishes the current trajectory and when it reaches the end, it uses the coordinate that was recorded at lake off, to find its way home. It hovers above the charging pad a few seconds to stabilize the position before it lands.
When landed it verifies that it is on the charging pad and that the battery is actually charging. If not, it will take off again and repeat the landing procedure.
The Situation awareness sub system is used to detect if the Crazyflie has crashed. If this is the case, the motors are stopped and the state machine is moved to a permanent crash state, awaiting human help.
The trajectory is pre-programed and hard coded in the app. It is handled by the High level commander that uses the Mellinger controller for control.
The trajectory is designed as a downwards spiral with a return path up in the center. It makes it possible to fly multiple (at least up to 4) Crazyflies at the same time at different phases of the trajectory, without colliding or getting into the down wash of another quadrotor.
The timing of the trajectory is good enough to start multiple Crazyflies and keep them running without any further adjustments.

The Control tower is responsible for starting Crazyflies at the correct moment. In normal operation one Crazyfly is flying all the time and with 7 Crazyflies charging it is possible to maintain continuous operation.
It is possible to run the Control tower with more than one quadrotor active simultaneously, when it tries to slot them in equally spaced in the trajectory. It (sort of) works with up to 4 Crazyflies at the same time, but the risk of failure increases with the number of copters (which makes it more fun!).
There is also a synchronous mode where multiple Crazyflies are started side by side to fly the trajectory in parallel. This mode does not support live replacements when the batteries are out though.
The Control tower is implemented in python using the Crazyflie python lib. It is based on a main control loop that evaluates the current situation in every iteration and takes appropriate action based on the state of the available quadrotors.
Each Crazyflie is monitored and controlled by a Controller that runs in its own thread. The most basic functionality is to keep the connection with the Crazyflie alive and reconnect when needed. When connected, logging is set up for the current state in the remote state machine, battery level as well as the current progress in the trajectory. The Controllers also have functions for sending commands to the Crazyflies.
The main loop queries the Controllers of the current state to determine if any action is needed. Basically it checks if the correct number of Crazyflies are flying. If not it will prepare the required number of Crazyflies by sending the take off command and eventually slot them in the flight pattern at the appropriate time. Only Crazyflies with a charged battery are taken into consideration for flight.
The control tower does not store an internal state, other than what it receives from the Crazyflies through the logging sub system. This makes it very robust and it can be restarted at any time without any further implications. This is also true for the Crazyflies that can be restarted at any time.
The following products were used in the demo, they are available for purchase in our store.
The Crazyflie 2.1 is a small, flexible quadrotor, suitable for research and education. The small size and light weight makes it safe and robust if crashing, while the open source software opens up the possibility to modify or examine any part of the functionality.

The Lighthouse Positioning System is based on the Valve Lighthouse base stations, used in the HTC Vive Virtual Reality gaming kit. It has very high precision and accuracy to an affordable price, making it possible to use in any office or class room. The position is estimated in the Crazyflie quadrotor which makes the system robust and easy to use.

The Qi 1.2 wireless charging deck uses the same standard as mobile phones which makes it easy to find a compatible charger.

The Crazyradio PA is a USB dongle radio that is used to communicate with the Crazyflie. It supports up to 800 packets/s to multiple Crazyflies simultaneously.
The charging pads are based on the wireless charger “NORDMÄRKE” from IKEA with a 3D-printed pad. The FreeCad and stl files for the pad are available on GitHub in Landing_pad_rallen_v5.fcstd and Landing_pad_v5.stl.

The source code for the demo is available on GitHub under the folder example/demo/swarm_demo. Most of the functionality in the firmware is implemented in app.c and the Control tower is implemented in control_tower.py.
More information and how to setup the lighthouse positioning system.