Models of quadrotor drones for estimation and control tasks.
Project description
$$ \huge \displaystyle \dot{x} = f(x,u) $$
Physics-based and data-driven quadrotor dynamics models for estimation, control, and simulation.
Overview
drone-models provides quadrotor dynamics as pure Python functions, from full physics-based implementations to lightweight data-driven approximations. All models support NumPy, JAX, and any Array API backend, plus CasADi symbolic variants for optimization-based control. Pre-fitted parameters are included for several Crazyflie platforms.
Available models — ranging from high-fidelity to lightweight:
| Model | Description |
|---|---|
first_principles |
Full rigid-body physics with optional rotor dynamics and aerodynamic drag |
so_rpy_rotor_drag |
Data-driven, attitude as roll/pitch/yaw, with rotor dynamics and drag |
so_rpy_rotor |
Data-driven, attitude as roll/pitch/yaw, with rotor dynamics |
so_rpy |
Lightest data-driven model, attitude as roll/pitch/yaw, no rotor dynamics |
Pre-fitted configurations for Crazyflie 2.x (brushed) and Crazyflie 2.1 Brushless:
cf2x_L250, cf2x_P250, cf2x_T350, cf21B_500
Installation
pip install drone-models
For system identification (fitting parameters from your own flight data):
pip install "drone-models[sysid]"
Note:
drone_modelsmust be imported before SciPy to enable Array API support. If you encounter aRuntimeError, either importdrone_modelsfirst or setexport SCIPY_ARRAY_API=1in your shell.
Usage
Basic
Bind parameters to a drone configuration with parametrize, then call the model with state and command arrays:
import numpy as np
from drone_models import parametrize
from drone_models.first_principles import dynamics
model = parametrize(dynamics, drone_model="cf2x_L250")
pos = np.zeros(3)
quat = np.array([0., 0., 0., 1.]) # xyzw, identity
vel = np.zeros(3)
ang_vel = np.zeros(3)
rotor_vel = np.ones(4) * 12_000. # current motor RPMs
cmd = np.full(4, 15_000.) # commanded motor RPMs
pos_dot, quat_dot, vel_dot, ang_vel_dot, rotor_vel_dot = model(
pos, quat, vel, ang_vel, cmd, rotor_vel
)
The model returns continuous-time state derivatives $\dot{x} = f(x, u)$. Integrate with any ODE solver (e.g. scipy.integrate.solve_ivp) to simulate forward in time.
Switching backends
Pass any Array API-compatible array and the output type follows automatically — no code changes needed:
import jax.numpy as jnp
from drone_models import parametrize
from drone_models.first_principles import dynamics
model = parametrize(dynamics, drone_model="cf2x_L250", xp=jnp)
# Pass jax arrays — get jax arrays back
Arbitrary leading batch dimensions work out of the box: stack states for a thousand drones and evaluate them in one call.
Symbolic models (CasADi)
Every model exposes a symbolic_dynamics function returning CasADi MX expressions, for use in MPC, trajectory optimization, or estimation:
from drone_models import parametrize
from drone_models.first_principles import symbolic_dynamics
sym_model = parametrize(symbolic_dynamics, drone_model="cf2x_L250")
Development
Clone and install with pixi:
git clone https://github.com/utiasDSL/drone-models.git
cd drone-models
pixi install
Run tests:
pixi run -e tests tests
Citation
Citation information coming soon. See the docs for updates.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drone_models-0.1.0.tar.gz.
File metadata
- Download URL: drone_models-0.1.0.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a52803b13e34a688c91e6c3f933b80a284ba519be1f09d1b063938113230a772
|
|
| MD5 |
d6dde635b0eb1ec3f572258203b98fca
|
|
| BLAKE2b-256 |
5afc857774840a6ed7d8fd78cd29587daa49755e818fc8bf4d49ebe87a5e371b
|
File details
Details for the file drone_models-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drone_models-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e35af621a86ff3ba9570bf1367d11edfc3ccde0eaf239c2d853cc3df11885063
|
|
| MD5 |
34255e14c7e27d0afc815ac9a1b8d2bc
|
|
| BLAKE2b-256 |
60da5166e0bf3bf3a2c8eee8864d2dd6932add366c6fb128634785cc2a3dd1b5
|