Skip to content

flybotsFlight algorithms, from scratch

Multirotor, fixed-wing and VTOL flight models with the physics written out in full — plus 42 runnable simulations and a gym for teaching a drone to fly itself.

See it fly

Seventy-eight seconds: nine algorithm families in depth, then every one of the 42 simulations in the library. Every frame is simulated by scripts/make_promo.py at render time — the same models this library ships, integrated live. No stock footage, and nothing that can drift out of sync with the code.

42
runnable simulations
3
airframe families
6
RL environments
600+
tests

Sixty seconds to first flight

bash
pip install flybots

flybots doctor            # verify the install, run the physics self-checks
flybots list              # browse 42 simulations
flybots run pid_hover     # render one to a GIF
flybots train hover       # teach a quadrotor to hold position

Or drive it from Python:

python
from uav_sim.vehicles.fixed_wing import create_fixed_wing, FixedWingPreset
from uav_sim.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 "from scratch" means here

No solver is wrapped. No dynamics library is imported. The Newton-Euler equations, the aerodynamic coefficient build-up, the Kalman recursions and the sampling-based planners are all written out, in NumPy, next to the citation they came from.

That is the point: the code is meant to be read. If a line needs a comment to explain what it does, something is named wrong; if it needs one to explain why, it has one.

A worked example

The fixed-wing model is the best illustration. It carries thirty-odd stability derivatives, and every one of them changes the aircraft's behaviour — there is a test that fails if you zero any of them.

Where to go next

Released under the MIT License.