flybots
Flight algorithms, from scratch.
Multirotor, fixed-wing and VTOL flight models with the physics written out in full — plus 53 runnable simulations and a gym for teaching a drone to fly itself.
Documentation · Getting started · Flight models · Reinforcement learning · Algorithm atlas
Quadrotor, fixed-wing, VTOL, planning, trajectory generation, estimation, mapping, swarms and reinforcement learning, closing on all 53 simulations. Every frame is simulated at render time by scripts/make_promo.py — no stock footage, and nothing that can drift out of sync with the code. Above is a sample of each scene; the full seventy-eight seconds, at full resolution, is on the docs site.
Install
pip install flybots
flybots doctor # verify the install, run the physics self-checks
flybots list # browse 53 simulations
flybots run pid_hover # render one to a GIF
flybots train hover # teach a quadrotor to hold position
Sixty seconds in
A fixed wing, trimmed and flown to a new altitude and heading:
from flybots.vehicles.fixed_wing import create_fixed_wing, FixedWingPreset
from flybots.control.fixed_wing_autopilot import FixedWingAutopilot, AutopilotCommand
aircraft = create_fixed_wing(FixedWingPreset.SKYWALKER_X8)
aircraft.reset_trimmed(altitude=120.0) # solve for equilibrium flight
pilot = FixedWingAutopilot(aircraft.fw_params) # gains derived from the airframe
command = AutopilotCommand(altitude=160.0, airspeed=20.0, course=1.0)
for _ in range(12_000):
aircraft.step(pilot.compute(aircraft.state, command, 0.01), 0.01)
print(aircraft.state[2]) # 160.0
What is here
| Vehicles | 6DOF quadrotor with motor dynamics · full Beard & McLain fixed-wing · tilt-rotor VTOL that transitions |
| Control | Cascaded PID · LQR · MPC · pure pursuit · geometric SO(3) · fixed-wing autopilot · VTOL mode scheduler |
| Planning | A* · RRT* · PRM · potential field · coverage · min-snap · Frenet · quintic |
| Estimation | EKF · UKF · particle filter · complementary filter · EKF-SLAM |
| Perception | Occupancy mapping · obstacle detection · visual servoing · gimbal tracking |
| Swarm | Reynolds flocking · consensus · virtual structure · leader-follower · Voronoi coverage |
| Comms | Algebraic connectivity maintenance · relay coverage · path-loss and Gaussian link models |
| Safety | Control barrier functions · CBF-QP safety filter · geofence, separation and speed barriers |
| Learning | 6 RL environments · pure-NumPy trainer (ARS, CEM) · optional Gymnasium integration |
Nothing here wraps a solver. The Newton-Euler equations, the aerodynamic coefficient build-up, the Kalman recursions and the sampling-based planners are written out in NumPy next to the citation they came from.
Flight models
Three airframes, one frame convention, so they compose.
from flybots.vehicles.fixed_wing import create_fixed_wing, FixedWingPreset
aircraft = create_fixed_wing(FixedWingPreset.AEROSONDE)
controls = aircraft.reset_trimmed(airspeed=35.0, altitude=200.0)
for _ in range(6000):
aircraft.step(controls, 0.005)
aircraft.state[2] # 200.0 — thirty seconds, open loop, no drift
That is the acceptance test for the whole aerodynamic model: if any force or moment is inconsistent, trim is not an equilibrium and the aircraft wanders. Every stability derivative is live, and there is a test that fails if you zero any of them.
- Fixed-wing — coefficient build-up, stall, trim solver
- VTOL tilt-rotor — hover → cruise → hover with altitude held
- Quadrotor — mixer and per-motor dynamics
Teach one to fly
flybots envs # 6 tasks: hover, waypoint, trajectory, landing, 2 fixed-wing
flybots train hover # pure NumPy — no deep-learning stack
flybots play hover --policy policies/hover.npz --gif hover.gif
from flybots.gym import make, train, evaluate
result = train("hover", iterations=120, seed=0)
print(evaluate("hover", result.policy, episodes=25))
Gymnasium's API without the Gymnasium dependency. Install
flybots[gym] and the environments register as flybots/Hover-v0 for use
with any standard RL library.
The interesting part is not the algorithm — it is that four setup choices decide whether these tasks are learnable at all. Each is documented with the measurement that motivated it.
Simulations
Forty-odd runnable demos, each with a three-panel animation, an academic reference and a JSON log:
flybots list
flybots info astar_3d
flybots run astar_3d
Browse them all in the algorithm atlas.
Conventions
Worth ten minutes before you write a controller:
| Frame | Axes | |
|---|---|---|
| World | ENU | x east, y north, z up |
| Body | FLU | x forward, y left, z up |
A consequence of Forward-Left-Up is that positive pitch is nose-down, and because the world is ENU, banking right decreases the heading. Aerodynamics texts use Forward-Right-Down; the library converts at the boundary rather than rewriting the equations. Full details in Frames and conventions.
Development
# The simulation GIFs live in Git LFS and are ~150 MB. Skipping them clones
# in a few seconds and leaves small pointer files in their place, which is
# what you want unless you are regenerating the GIFs themselves. Drop the
# prefix to fetch them, or run `git lfs pull` later.
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/guilyx/flybots.git
cd flybots
uv sync --all-groups
uv run flybots doctor
uv run pytest
pre-commit install && pre-commit install --hook-type commit-msg
Contributions welcome — see CONTRIBUTING.md for the bar a new algorithm has to clear, and CHANGELOG.md for what has changed.
Safety
These models are simplified, the controllers are not certified, and nothing here has been validated against a real airframe. Do not fly hardware on control code taken from this repository without independent verification. See SECURITY.md.
Citing
If flybots helps your teaching, research or software, please cite it —
GitHub's Cite this repository button reads
CITATION.cff.
We intend to publish it as a peer-reviewed software paper; the plan and its
status are in
Citing and publication.
License
MIT — see LICENSE.
Metadata
Release files for flybots 2.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 | Actions |
|---|---|---|---|---|
| flybots-2.1.0.tar.gz | 786.5 kB | Without provenance | Details for flybots-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flybots-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for flybots-2.1.0-py3-none-any.whl |
Total release size: 1.3 MB
Release files / flybots-2.1.0.tar.gz
| Download URL | flybots-2.1.0.tar.gz |
|---|---|
| Size | 786.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b719fd05e0282ccd3504027e5048647c617a599e100dcdf7710ccd2b67f36e7d
|
|
BLAKE2b-256 checksum How to use checksums |
c6f9fcea07feb328a5a5dc2f597d0552e697284332fe4898ec7e522fd8ad1253
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flybots-2.1.0-py3-none-any.whl
| Download URL | flybots-2.1.0-py3-none-any.whl |
|---|---|
| Size | 517.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1df6d73e7fc040f972b072d0c1f83cb070eeee085d5f4a927c7ca84af0959c1
|
|
BLAKE2b-256 checksum How to use checksums |
4b7e2c27aa803ffd794143af8b78d11147c8b3aeb57339c737d80d60dd1338ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for flybots 2.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.