Package qfly

qfly | Qualisys Drone SDK

Qualisys Drone SDK

qfly | Qualisys Drone SDK is a Python library to track and fly drones with Qualisys motion capture systems. It is is designed to be an entry point for students, researchers, engineers, artists, and designers to develop drone applications.

STATUS: DEV PREVIEW :: Development and testing is ongoing for many features. For bug reports, feature requests, and other contributions, please use Issues.

qfly is architected as a concurrent wrapper running the Qualisys Python SDK together with Python libraries for popular drone platforms like Bitcraze Crazyflie and Robomaster TT. It dramatically reduces the software development workload for real-time drone control, compared to using these libraries vanilla form. For creative applications like drone shows, light painting, and cinematography, movements can be easily programmed by non-engineers using principles of keyframe animation. For interactive applications like games and exercise, qfly is able to ingest signals and control drones in real time.

Various safety, stability, and convenience measures are built in, including:

  • geofencing
  • speed limits
  • smooth takeoff and landing
  • interrupt and land

qfly can control swarms comprising an arbitrary combination of drones, e.g. Bitcraze Crazyflie and Ryze Tello EDU drones can be flown together. The maximum number of drones in the swarm depends on limitations of the drone's software and electronics as well as fleet management practicalities.

Requirements

  • Python 3.10 or equivalent
  • Python packages (install using pip):
    • qtm (Qualisys Python SDK) 2.1.1 or equivalent
    • cflib (for Crazyflie Drones) 0.1.18 or equivalent

qfly has been designed and tested on Windows. It may or may not work on other operating systems.

Setup

To install qfly DEV PREVIEW:

  1. Clone the qfly source code to your local machine.
  2. Navigate to the package root directory and install the qfly package in "development mode" by running: python -m pip install -e .

Drone Platforms and Example Scripts

Bitcraze Crazyflie

Bitcraze Crazyflie

Requirements

Setup

  • Install drivers for both Crazyflie and the Crazyradio dongle using Zadig following Bitcraze's instructions.
  • To fly multiple drones, assign different radio addresses to them using the Crazyflie PC client. Refer to "Firmware Configuration" in the Crazyflie PC client docs.\

    • This can be done over the Crazyradio (requires you to know the current radio address, see Bitcraze docs) or over USB (requires Crazyflie driver, see above).
  • To fly multiple drones, assign different radio addresses to them using the Crazyflie PC client. (Refer to "Firmware Configuration" in the Crazyflie PC client docs.) This can be done over the Crazyradio (requires you to know the current radio address, see Bitcraze docs) or over USB (requires Crazyflie driver, see above).

  • Before takeoff with the Crazyflie, always place the drone flat on the floor, with its front pointing in the positive x-direction of the QTM coordinate system.

Examples

  • In case of emergency, press Ctrl + C in the terminal window to terminate the program.

  • White running the example scripts, Press Esc to stop the program and attempt to calmly land the drone.

  • The swarm scripts have so far been tested with 4 drones. They may or may not work with more drones. Testing with larger swarms is in progress.

cf_solo.py

This script demonstrates a basic scenario using the Qualisys motion capture system to control the flight path of a Crazyflie. The script commands the Crazyflie to:

  1. Take off and hover at the center of its airspace
  2. Circle around the Z axis
  3. Circle around the Y axis
  4. Circle around the X axis
  5. Come back to center, land carefully

cf_multi.py

The drones take off and fly circles around Z axis.

cf_interactive_deck.py

This script demonstrates real-time interactive control of a Crazyflie, coupling the drone's flight to the position of another drone equipped with an Active Marker Deck.

The drone flies along the YZ plane while centered at 0 along the X plane. The Y and Z coordinates track the second Crazyflie.

cf_interactive_traqr.py

This script demonstrates real-time interactive control of a Crazyflie, coupling the drone's flight to the position of a Qualisys Traqr.

The drone flies along the YZ plane while centered at 0 along the X plane. The Y and Z coordinates track the Traqr.

cf_multi_interactive.py

This script demonstrates real-time interactive control of a Crazyflie swarm, coupling the drones' flight to the position of a Qualisys Traqr.

The drones take off and fly circles around Z axis. The altitude (z) tracks the Traqr. ESC to land at any time.

Tello EDU

Robomaster TT

Coming soon…


Resources and Inspirations

Contributing

The auto-generated documentation needs to be rebuilt using pdoc3 following code contributions. To re-generate the documentation files and place them correctly into the docs/ folder that is served to the web, use the commands in Windows:

del docs\*.html
pdoc qfly --force --html --output-dir docs
move .\docs\qfly\* .\docs\
Expand source code
#
#  "qfly"
#  Qualisys Drone SDK
#
#  Copyright (C) 2022 Qualisys AB
#

# include README to auto-generate documentation with pdoc
"""
.. include:: ../README.md
"""


from .crazyflie import QualisysCrazyflie
from .deck import QualisysDeck
from .pose import Pose
from .qtm import QtmWrapper
from .traqr import QualisysTraqr
from .world import World
from .parallel_contexts import ParallelContexts

Sub-modules

qfly.crazyflie
qfly.deck
qfly.parallel_contexts
qfly.pose
qfly.qtm
qfly.traqr
qfly.utils
qfly.world