Until now, the Loco Positioning System have been limited to flying only one Crazyflie autonomously. In this post we will try to explain the reason of this limitation and what are the way forward.
The loco positioning system is based on Ultra Wide Band (UWB) radios that can very precisely measure the time of departure and arrival of a radio packet. This allows us to do two things:
- Use these times directly to calculate the flight time of the radio packet. This is called time of arrival (ToA) measurement, it can be done by simply pinging one anchor. No extra synchronization is required.
- Use the difference between the arrival of packets from two different anchors. This is called time difference of arrival (TDoA), it requires the system of anchors to be synchronized together.
The method 1) is simpler to implement since it does not require the anchor system to be synchronized, though it requires bidirectional communication between the tag (eg. Crazyflie) we want to locate and the anchors. It means that if you want to locate more than one tag you have to somehow share the air by not ranging all at the same time. The method 2) requires extra work to synchronize the system of anchor and is theoretically more sensitive to measurement noise. However TDoA measurements have a huge advantage: they can be made to work with unidirectional signal sent from the anchors. This means that the tag only has to listen to the air to receive all information needed to locate itself. This allows to scale the location system to as many tag as we want since adding a tag do not have to share the air, they are not transmitting anything.
So far we have been concentrating on ToA measurement since it could easily be implemented and gives us the best theoretical ranging performance. This allows to develop the algorithms to calculate position estimates and stabilize the autonomous flight. The problem is that, since we are just ranging as fast as possible with all the anchors of the system, one Crazyflie will take all the available air-time and we cannot fly another Crazyflie at the same time. We have just implemented a solution to fly more than one Crazyflie with ToA measurement using time-slots, this is called TDMA for Time Division Multiple Access, and it can be done without anchor code modification. We are working on the Maker Faire demo using this method and it is starting to work quite well:
For TDMA we define frame and time slot. One time slot is a space in time where one tag will be allowed to communicate without risking collision with others. One frame is a group of timeslot. Each Crazyflie is configured to use one time slot in each frame.
Normally implementing TDMA would require some kind of synchronization to make sure each Crazyflie knows when its time slot starts. With the LPS we are in luck though since transmitting time is part of the way the ranging is working: we do not have to implement new messages or even to modify the anchors to implement TDMA.
We chose the timer in anchor 1 as our master clock for TDMA. When a Crazyflie starts it ranges with anchor 1 which allows to get the current time in anchor 1, then the start of the next frame can be calculated and the Crazyflie can schedule to range in its next time slot. We range with one anchor per time slot and each time we range with anchor 1 we get a chance to re-synchronize.
The TDMA has been pushed to the Crazyflie master branch. It is documented in the commit message so please feel free to test it, report, and pull-request ;-). We have tested running in 2 slots mode with success. Very quickly though, when adding more time slots, the performance deteriorates because the rate of ranging per Crazyflie decreases. Then TDoA will lead to better performance which is the next target, after the Maker Faire Berlin :-).
3 comments on “Flying many Crazyflie with Loco Positioning System”
How many drones the TDMA method could manage ?
We have currently successfully tested up to 4 slots (ie. for 4 simultaneous drones). More should be possible but the precision of the positioning will be affected. Tuning the Kalman filter so that it can accept lower ranging rate will help flying more Crazyflie, it also helps to have more space since we could then afford more inaccuracy.
I just wanted to say thank you. This stuff excites me and the more the intel the better :)