$$ \huge \begin{aligned} \hat{\boldsymbol{\mu}}{x,k+1} &= \check{\boldsymbol{\mu}}{x,k+1} + \mathbf{K}{k+1} \mathbf{z}{k+1} \ \hat{\boldsymbol{\Sigma}}{xx,k+1} &= ( \mathbf{I} - \mathbf{K}{k+1} \mathbf{C}{k+1} ) \check{\boldsymbol{\Sigma}}{xx,k+1} \end{aligned} $$
Drone state estimators @ LSY. Contains model free and model based state estimators for drones.
Overview
The estimators are written against the Python Array API standard, so they run with NumPy as well as JAX. They can be batched over many drones, and with JAX also jit compiled.
The documentation covers installation, usage, the ROS 2 node, and the API reference.
Installation
pip install drone-estimators
The ROS 2 node additionally needs a ROS 2 installation. The development setup below provides ROS 2 Kilted through pixi.
Development
git clone https://github.com/learnsyslab/drone-estimators.git
cd drone-estimators
pixi shell
The default environment contains ROS 2 Kilted and installs drone_estimators in editable mode. On first activation, it also clones and builds motion_capture_tracking in ros_ws/.
Run the tests with:
pixi run -e tests tests
Usage
Estimators
import numpy as np
from drone_estimators.estimator_kalman import KalmanFilter
kf = KalmanFilter(dt=1 / 200, model="so_rpy", config="cf2x_L250")
kf.set_state(pos=np.zeros(3), quat=np.array([0.0, 0.0, 0.0, 1.0]))
# Command as roll, pitch, yaw [rad] and collective thrust [N]
kf.predict(dt=1 / 200, command=np.array([0.0, 0.0, 0.0, 0.3]))
estimate = kf.correct(pos=np.array([0.0, 0.0, 0.001]), quat=np.array([0.0, 0.0, 0.0, 1.0]))
print(estimate.pos, estimate.vel, estimate.ang_vel)
To estimate many drones at once, pass a batch_shape:
kf = KalmanFilter(dt=1 / 200, model="so_rpy", config="cf2x_L250", batch_shape=(10,))
For faster estimation loops, jit compile the filter with JAX:
kf = KalmanFilter(dt=1 / 200, model="so_rpy", config="cf2x_L250", batch_shape=(10,), jit=True)
The differentiation-based filter is DiffFilter in drone_estimators.estimator_diff.
ROS 2 node
python -m drone_estimators.ros.node --drone_name cf1 --estimator_type ukf
python -m drone_estimators.ros.node --drone_name cf1 --estimator_type diff
python -m drone_estimators.ros.node --settings path/to/estimators.toml
The settings are read from estimators.toml. To estimate several drones, add one [estimatorX] section per drone and pass your file with --settings. Drones with identical settings are batched into one estimator.
The node subscribes to /tf (e.g., from motion_capture_tracking) and to /drones/<name>/command (roll, pitch, yaw in deg and thrust in PWM, needed by the UKF). It publishes the estimates to /drones/<name>/estimate/{pose,twist,wrench,rotor_vel}. The node only communicates with nodes on the same machine (ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST).
To read the estimates in Python without blocking, use the ROSConnector:
import rclpy
from drone_estimators.ros import ROSConnector
rclpy.init()
conn = ROSConnector(estimator_names=["cf1"], timeout=10.0)
print(conn.est_pos["cf1"], conn.est_vel["cf1"])
conn.close()
Metadata
Release files for drone-estimators 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| drone_estimators-0.1.0.tar.gz | 36.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drone_estimators-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.6 kB
Release files / drone_estimators-0.1.0.tar.gz
| Download URL | drone_estimators-0.1.0.tar.gz |
|---|---|
| Size | 36.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7bc6cea0304f60f25f52622cab78002a2cefbfa77b7a51a95b3bdd066bc3053
|
|
BLAKE2b-256 checksum How to use checksums |
0416225cbe849f45fe763c8bfcd115943a25007dec3451859ee4572ffd63cdc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / drone_estimators-0.1.0-py3-none-any.whl
| Download URL | drone_estimators-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0f3be005863e2df7ba0a354815f85c2ee5a93d92a59efef6bab6f73db565a6e
|
|
BLAKE2b-256 checksum How to use checksums |
1a449c4a3aa8d79ed2b030a19842c8e416a8c7f2fed42fbf0b7a0764ec6c9765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for drone-estimators 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.