Skip to main content

aerial-kit

Control stack for aerial robots. The core has no ROS or Matplotlib dependency; simulation and visualization are available as optional extras.

For firmware, hardware integration, and the full ROS 2 / simulation stack, visit the repo: github.com/RawFish69/aerial-kit.

What's in it

  • aerial_kit.types - SimState, ControlTarget, Capabilities, Wrench, CommandKind, Waypoint
  • aerial_kit.interfaces - Controller, DynamicsBackend, Planner ABCs
  • aerial_kit.registry - a pluggable component registry (register_airframe/register_controller/etc., create_* factories)
  • aerial_kit.airframes - Airframe ABC, MultirotorAirframe (mixer-driven quad/hex/ octo), TwinWingAirframe (elevon + differential-thrust allocation, trim)
  • aerial_kit.dynamics - 6-DOF multirotor dynamics, point-mass dynamics, and a hand-rolled 6-DOF fixed-wing model with a flat-plate-blended lift curve, drag polar, and moment derivatives
  • aerial_kit.controllers - PID/LQR/MPC position controllers; ConstrainedMPC (QP MPC with acceleration and speed limits inside the optimisation, solved by a small ADMM BoxQP); MPPI (vectorised, warm-started sampling controller with sphere-obstacle and floor costs); PathReference (horizon references along a waypoint polyline); attitude-level GeometricController (SE(3) tracking with flatness feedforward) and NMPCController (iLQR nonlinear MPC on thrust and body rates), both producing a wrench; and FixedWingL1TECSController (L1 lateral guidance + TECS-lite longitudinal control + coordinated-turn attitude PID)
  • aerial_kit.guidance - l1_bank_command, tecs_command as standalone functions
  • aerial_kit.trajectory - MinSnapTrajectory: piecewise minimum-snap through waypoints with speed/acceleration/jerk limits and optimised segment times, queryable for position through snap and as a FlatReference
  • aerial_kit.estimation - InsEkf: loosely coupled INS Kalman filter (GPS, baro, optional accelerometer; bias states, outlier gating); SimulatedIns: simulated GPS, baro and IMU feeding it, so a simulated controller can fly on the estimate (simulation.estimator.mode: ekf)

Quick start

import numpy as np

from aerial_kit import (
    SimState,
    Waypoint,
    create_airframe,
    create_controller,
    register_builtin_components,
)

register_builtin_components()
airframe = create_airframe("quad")
controller = create_controller("pid")
state = SimState(position=np.zeros(3), velocity=np.zeros(3))
waypoint = Waypoint(position=np.array([1.0, 0.0, 1.0]))
target = controller.compute(state, waypoint, {})
assert target.accel_cmd.shape == (3,)
print(airframe.capabilities.command_kind, target.accel_cmd)

The top-level exports, aerial_kit.interfaces, aerial_kit.types and aerial_kit.registry are the typed public contract and are checked in CI with strict function signatures. The distribution ships a PEP 561 partial marker: specialized numerical internals remain importable but are not claimed as a fully typed API surface.

register_builtin_components() here registers only what lives inside aerial_kit itself (airframes, controllers) - it has no ROS or matplotlib dependency and does not know about any host application's own dynamics backends or planners. A host application (like sim_py in the parent repo) registers its own backends/planners into the same registry alongside this.

Flight-controller CLI

The ak executable auto-detects an Aerial Kit controller (AKP) or a Betaflight controller (MSP) on a USB serial port:

ak fc status --port /dev/ttyACM0
ak fc rc --port /dev/ttyACM0
ak fc params --port /dev/ttyACM0 --name failsafe_throttle
ak fc get failsafe_throttle --port /dev/ttyACM0
ak fc set failsafe_throttle 1200 --port /dev/ttyACM0 --write
ak fc save --port /dev/ttyACM0 --write
ak fc preflight --port /dev/ttyACM0 --protocol betaflight --json fc-preflight.json
ak fc rc --port /dev/ttyACM0 --protocol betaflight --json fc-rc.json
ak doctor
ak doctor --probe /dev/ttyACM0

Use --protocol akp or --protocol betaflight to skip auto-detection. Reads are safe by default. Configuration writes require --write, are refused while the board reports itself armed, and are never retried after a refusal. Aerial Kit parameters can be enumerated; Betaflight settings are addressed by name because MSP has no enumerate-all command.

ak fc status treats a successful Betaflight MSP response as proof that the flight controller is reachable, not proof that its receiver is linked. Betaflight prints link=unknown; take a fresh ak fc rc observation and decode the arming-disable flags with ak fc preflight. Failsafe or receiver-failsafe flags make the preflight command exit nonzero.

For bounded live keyboard control through the CRSF transmitter:

ak radio teleop --port /dev/ttyACM0 --profile betaflight \
  --duration 30 --write --confirm-arm

The stream starts disarmed. Press Enter to arm after the low-throttle hold; A/D, W/S and Q/E step roll, pitch and yaw, R/F change throttle, C centres the sticks, and X panic-disarms and exits. Every exit path attempts a disarmed frame. The no-argument ak teleop command remains the simulator viewer.

ak doctor is the read-only discovery command. Without --probe it lists serial endpoints and permissions without opening hardware. With --probe PATH it attempts read-only CRSF, AKP and Betaflight identification and reports every attempt.

Simulation and visualization

Install the optional simulator and Matplotlib viewer:

python -m pip install "aerial-kit[sim]"

Run the bundled default quadrotor scenario:

aerial-kit-sim
aerial-kit-sim --example fixed-wing
aerial-kit-sim --no-show --save result.png

Teleop

Launch real-time keyboard teleoperation with one command:

aerial-kit-teleop                          # quadrotor
aerial-kit-teleop --airframe fixed-wing    # twin-wing

Quadrotor — drone-style controls:

Key Action
W / S or Up / Down forward / backward
A / D or Left / Right strafe left / right
Space / Shift climb / descend
Q / E yaw left / right

Fixed wing — RC-plane-style controls (no rudder, so Q/E biases differential thrust rather than yawing directly):

Key Action
W / S or Up / Down pitch: dive / climb
A / D or Left / Right bank: turn right / left
Space / Shift throttle up / down
Q / E differential-thrust yaw nudge

Shared: X neutralize, P pause, C toggle follow/world camera, -/= zoom, H hide help, Esc exit.

Controls are body-relative, so yawing with Q/E changes where W takes you. Click the plot window first; the HUD shows NO FOCUS when keystrokes are not reaching it, and held keys are released whenever focus is lost. The follow camera is a third-person chase view that stays behind the vehicle and turns with its heading.

The equivalent simulator commands are aerial-kit-sim --teleop and aerial-kit-sim --example fixed-wing --teleop. Without installing the package, run python -m aerial_kit.sim.teleop (add --airframe fixed-wing for the wing) from the repository root, or python examples/quadrotor/teleop.py / python examples/fixed_wing/teleop.py from anywhere (which is also what an IDE Run button does). Teleop needs an interactive Matplotlib backend and fails with an explanatory message if the active backend can only write files.

The public Python API accepts a YAML path, a mapping, or a normalized config:

from aerial_kit.sim import load_config, run_simulation
from aerial_kit.visualization import plot_simulation

config = load_config("examples/quadrotor/config.yaml")
result = run_simulation(config)
print(f"goal error: {result.distance_to_goal:.2f} m")
plot_simulation(result)

Complete configurable examples are included in the repository:

  • examples/quadrotor: quad airframe, PID control, and native multirotor dynamics.
  • examples/fixed_wing: twin-motor flying wing, Dubins planning, native 6-DOF dynamics, and L1/TECS control.

The fixed-wing example starts at cruise airspeed to represent a hand launch. A fixed wing cannot be initialized at zero velocity like a hovering multirotor.

Status

Early and actively developed. Be clear-eyed about what's actually verified:

  • Multirotor (quad/hex/octo airframes, PID/LQR/MPC): verified, working. This is the path flying on real hardware in the parent project.
  • Twin-motor wing (TwinWingAirframe, FixedWingL1TECSController, L1/TECS guidance): under development, simulation-only. Not flown on any hardware. Its 6-DOF aero model uses plausible placeholder coefficients, not a fitted model of any specific real airframe, and its guidance gains are validated only in the specific simulated scenarios its own test suite covers - treat it as a research/simulation component, not something to fly as-is.

License

MIT

Metadata

Release files for aerial-kit 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aerial-kit 0.5.0
File Size Uploaded Provenance Actions
aerial_kit-0.5.0.tar.gz 407.5 kB With provenance Details for aerial_kit-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aerial-kit 0.5.0
File Interpreter ABI Platform Actions
aerial_kit-0.5.0-py3-none-any.whl Python 3 none any Details for aerial_kit-0.5.0-py3-none-any.whl

Total release size: 846.2 kB

Release files / aerial_kit-0.5.0.tar.gz

Download URL aerial_kit-0.5.0.tar.gz
Size 407.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7da07c7a0e10fcd078c8405272261af3ef91efdf1b1c89e5f4df09fc713215a7
BLAKE2b-256 checksum
How to use checksums
d66cdfa4bde3ecbab3d28acc24dbfb01b8556b012ffebcaf8ef67b5fb3bf2464
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / aerial_kit-0.5.0-py3-none-any.whl

Download URL aerial_kit-0.5.0-py3-none-any.whl
Size 438.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9aaba42d17d416c8aa92e5aa735b3ab85b56e8b6a10df5b797bd28236c89171
BLAKE2b-256 checksum
How to use checksums
aa6f4cead60624e4efb2a6f862577f56411d05159737f0a70fb18cea3d1acbf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for aerial-kit 0.5.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aerial_kit-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page